From 3ab9f4e1dc52d4b1fb453f548b4a8424732f2f38 Mon Sep 17 00:00:00 2001 From: Sylvain Wallez Date: Tue, 24 May 2022 18:18:16 +0200 Subject: [PATCH] [codegen] Update to latest API spec --- .../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 | 274 ++-- .../enrich/EnrichConfiguration.java | 31 + .../enrich/PutPolicyRequest.java | 36 + .../clients/elasticsearch/ilm/IlmPolicy.java | 48 +- .../indices/IndexCheckOnStartup.java | 4 +- .../indices/analyze/ExplainAnalyzeToken.java | 47 + .../ml/ClassificationInferenceOptions.java | 9 + .../ml/ElasticsearchMlAsyncClient.java | 19 +- .../ml/ElasticsearchMlClient.java | 18 +- .../ml/FillMaskInferenceUpdateOptions.java | 8 +- ...est.java => InferTrainedModelRequest.java} | 104 +- .../ml/InferTrainedModelResponse.java | 176 +++ .../ml/InferenceConfigCreate.java | 32 + .../ml/InferenceConfigCreateBuilders.java | 20 + ...Update.java => InferenceConfigUpdate.java} | 150 ++- .../ml/InferenceConfigUpdateBuilders.java | 212 +++ ...java => InferenceConfigUpdateVariant.java} | 10 +- ...onse.java => InferenceResponseResult.java} | 207 ++- .../ml/NerInferenceUpdateOptions.java | 8 +- .../ml/NlpInferenceConfigUpdateBuilders.java | 155 --- .../ml/PassThroughInferenceUpdateOptions.java | 8 +- .../ml/QuestionAnsweringInferenceOptions.java | 276 ++++ ...estionAnsweringInferenceUpdateOptions.java | 306 +++++ .../ml/RegressionInferenceOptions.java | 9 + .../StartTrainedModelDeploymentRequest.java | 110 +- ...tClassificationInferenceUpdateOptions.java | 8 +- .../TextEmbeddingInferenceUpdateOptions.java | 8 +- .../ml/TrainedModelDeploymentNodesStats.java | 124 +- .../ml/TrainedModelDeploymentStats.java | 116 +- .../TrainedModelInferenceClassImportance.java | 173 +++ ...rainedModelInferenceFeatureImportance.java | 236 ++++ ...tClassificationInferenceUpdateOptions.java | 11 +- .../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 +- 66 files changed, 7077 insertions(+), 2277 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 rename java-client/src/main/java/co/elastic/clients/elasticsearch/ml/{InferTrainedModelDeploymentRequest.java => InferTrainedModelRequest.java} (67%) create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/ml/InferTrainedModelResponse.java rename java-client/src/main/java/co/elastic/clients/elasticsearch/ml/{NlpInferenceConfigUpdate.java => InferenceConfigUpdate.java} (62%) create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/ml/InferenceConfigUpdateBuilders.java rename java-client/src/main/java/co/elastic/clients/elasticsearch/ml/{NlpInferenceConfigUpdateVariant.java => InferenceConfigUpdateVariant.java} (77%) rename java-client/src/main/java/co/elastic/clients/elasticsearch/ml/{InferTrainedModelDeploymentResponse.java => InferenceResponseResult.java} (63%) delete mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/ml/NlpInferenceConfigUpdateBuilders.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/ml/QuestionAnsweringInferenceOptions.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/ml/QuestionAnsweringInferenceUpdateOptions.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TrainedModelInferenceClassImportance.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TrainedModelInferenceFeatureImportance.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 ea7668852..373213ee1 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 69f8d9166..fd669672b 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 27b57e02f..d00f354ec 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', @@ -1084,8 +1091,8 @@ 'dangling_indices.list_dangling_indices.DanglingIndex': 'dangling_indices/list_dangling_indices/ListDanglingIndicesResponse.ts#L29-L34', 'dangling_indices.list_dangling_indices.Request': 'dangling_indices/list_dangling_indices/ListDanglingIndicesRequest.ts#L22-L27', 'dangling_indices.list_dangling_indices.Response': 'dangling_indices/list_dangling_indices/ListDanglingIndicesResponse.ts#L23-L27', -'enrich._types.Configuration': 'enrich/_types/Policy.ts#L26-L29', -'enrich._types.Policy': 'enrich/_types/Policy.ts#L31-L37', +'enrich._types.Configuration': 'enrich/_types/Policy.ts#L26-L30', +'enrich._types.Policy': 'enrich/_types/Policy.ts#L32-L38', 'enrich._types.Summary': 'enrich/_types/Policy.ts#L22-L24', 'enrich.delete_policy.Request': 'enrich/delete_policy/DeleteEnrichPolicyRequest.ts#L23-L32', 'enrich.delete_policy.Response': 'enrich/delete_policy/DeleteEnrichPolicyResponse.ts#L22-L24', @@ -1095,7 +1102,7 @@ 'enrich.execute_policy.Response': 'enrich/execute_policy/ExecuteEnrichPolicyResponse.ts#L23-L28', 'enrich.get_policy.Request': 'enrich/get_policy/GetEnrichPolicyRequest.ts#L23-L32', 'enrich.get_policy.Response': 'enrich/get_policy/GetEnrichPolicyResponse.ts#L22-L24', -'enrich.put_policy.Request': 'enrich/put_policy/PutEnrichPolicyRequest.ts#L24-L37', +'enrich.put_policy.Request': 'enrich/put_policy/PutEnrichPolicyRequest.ts#L24-L38', 'enrich.put_policy.Response': 'enrich/put_policy/PutEnrichPolicyResponse.ts#L22-L24', 'enrich.stats.CacheStats': 'enrich/stats/types.ts#L37-L43', 'enrich.stats.CoordinatorStats': 'enrich/stats/types.ts#L29-L35', @@ -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', @@ -1529,7 +1536,7 @@ 'ml._types.Category': 'ml/_types/Category.ts#L23-L49', 'ml._types.ChunkingConfig': 'ml/_types/Datafeed.ts#L164-L177', 'ml._types.ChunkingMode': 'ml/_types/Datafeed.ts#L158-L162', -'ml._types.ClassificationInferenceOptions': 'ml/_types/inference.ts#L75-L90', +'ml._types.ClassificationInferenceOptions': 'ml/_types/inference.ts#L80-L95', 'ml._types.ConditionOperator': 'ml/_types/Rule.ts#L74-L79', 'ml._types.DataCounts': 'ml/_types/Job.ts#L124-L144', 'ml._types.DataDescription': 'ml/_types/Job.ts#L146-L162', @@ -1576,22 +1583,24 @@ 'ml._types.DataframeEvaluationRegressionMetricsMsle': 'ml/_types/DataframeEvaluation.ts#L112-L115', 'ml._types.DataframeState': 'ml/_types/Dataframe.ts#L20-L26', 'ml._types.DelayedDataCheckConfig': 'ml/_types/Datafeed.ts#L108-L119', -'ml._types.DeploymentAllocationState': 'ml/_types/TrainedModel.ts#L278-L291', -'ml._types.DeploymentState': 'ml/_types/TrainedModel.ts#L263-L276', +'ml._types.DeploymentAllocationState': 'ml/_types/TrainedModel.ts#L271-L284', +'ml._types.DeploymentState': 'ml/_types/TrainedModel.ts#L256-L269', 'ml._types.DetectionRule': 'ml/_types/Rule.ts#L25-L39', 'ml._types.Detector': 'ml/_types/Detector.ts#L25-L67', 'ml._types.DetectorRead': 'ml/_types/Detector.ts#L69-L80', 'ml._types.DiscoveryNode': 'ml/_types/DiscoveryNode.ts#L24-L30', 'ml._types.ExcludeFrequent': 'ml/_types/Detector.ts#L82-L87', -'ml._types.FillMaskInferenceOptions': 'ml/_types/inference.ts#L230-L238', -'ml._types.FillMaskInferenceUpdateOptions': 'ml/_types/inference.ts#L323-L330', +'ml._types.FillMaskInferenceOptions': 'ml/_types/inference.ts#L235-L243', +'ml._types.FillMaskInferenceUpdateOptions': 'ml/_types/inference.ts#L364-L371', 'ml._types.Filter': 'ml/_types/Filter.ts#L22-L29', 'ml._types.FilterRef': 'ml/_types/Filter.ts#L31-L41', 'ml._types.FilterType': 'ml/_types/Filter.ts#L43-L46', -'ml._types.Hyperparameter': 'ml/_types/TrainedModel.ts#L206-L220', +'ml._types.Hyperparameter': 'ml/_types/TrainedModel.ts#L199-L213', 'ml._types.Hyperparameters': 'ml/_types/DataframeAnalytics.ts#L390-L405', 'ml._types.Include': 'ml/_types/Include.ts#L20-L42', -'ml._types.InferenceConfigCreateContainer': 'ml/_types/inference.ts#L23-L62', +'ml._types.InferenceConfigCreateContainer': 'ml/_types/inference.ts#L23-L67', +'ml._types.InferenceConfigUpdateContainer': 'ml/_types/inference.ts#L259-L279', +'ml._types.InferenceResponseResult': 'ml/_types/inference.ts#L412-L459', 'ml._types.Influence': 'ml/_types/Anomaly.ts#L66-L69', 'ml._types.Influencer': 'ml/_types/Influencer.ts#L24-L76', 'ml._types.Job': 'ml/_types/Job.ts#L46-L70', @@ -1607,54 +1616,57 @@ 'ml._types.ModelPlotConfig': 'ml/_types/ModelPlot.ts#L23-L41', 'ml._types.ModelSizeStats': 'ml/_types/Model.ts#L47-L69', 'ml._types.ModelSnapshot': 'ml/_types/Model.ts#L24-L45', -'ml._types.NerInferenceOptions': 'ml/_types/inference.ts#L220-L228', -'ml._types.NerInferenceUpdateOptions': 'ml/_types/inference.ts#L316-L321', -'ml._types.NlpBertTokenizationConfig': 'ml/_types/inference.ts#L111-L138', -'ml._types.NlpInferenceConfigUpdateContainer': 'ml/_types/inference.ts#L242-L256', -'ml._types.NlpRobertaTokenizationConfig': 'ml/_types/inference.ts#L140-L167', -'ml._types.NlpTokenizationUpdateOptions': 'ml/_types/inference.ts#L274-L279', +'ml._types.NerInferenceOptions': 'ml/_types/inference.ts#L225-L233', +'ml._types.NerInferenceUpdateOptions': 'ml/_types/inference.ts#L357-L362', +'ml._types.NlpBertTokenizationConfig': 'ml/_types/inference.ts#L116-L143', +'ml._types.NlpRobertaTokenizationConfig': 'ml/_types/inference.ts#L145-L172', +'ml._types.NlpTokenizationUpdateOptions': 'ml/_types/inference.ts#L315-L320', 'ml._types.OutlierDetectionParameters': 'ml/_types/DataframeAnalytics.ts#L407-L414', 'ml._types.OverallBucket': 'ml/_types/Bucket.ts#L114-L127', 'ml._types.OverallBucketJob': 'ml/_types/Bucket.ts#L128-L131', 'ml._types.Page': 'ml/_types/Page.ts#L22-L33', -'ml._types.PassThroughInferenceOptions': 'ml/_types/inference.ts#L204-L210', -'ml._types.PassThroughInferenceUpdateOptions': 'ml/_types/inference.ts#L303-L308', +'ml._types.PassThroughInferenceOptions': 'ml/_types/inference.ts#L209-L215', +'ml._types.PassThroughInferenceUpdateOptions': 'ml/_types/inference.ts#L344-L349', 'ml._types.PerPartitionCategorization': 'ml/_types/Analysis.ts#L93-L102', -'ml._types.RegressionInferenceOptions': 'ml/_types/inference.ts#L64-L73', -'ml._types.RoutingState': 'ml/_types/TrainedModel.ts#L304-L325', +'ml._types.QuestionAnsweringInferenceOptions': 'ml/_types/inference.ts#L245-L255', +'ml._types.QuestionAnsweringInferenceUpdateOptions': 'ml/_types/inference.ts#L373-L384', +'ml._types.RegressionInferenceOptions': 'ml/_types/inference.ts#L69-L78', +'ml._types.RoutingState': 'ml/_types/TrainedModel.ts#L297-L318', 'ml._types.RuleAction': 'ml/_types/Rule.ts#L41-L50', 'ml._types.RuleCondition': 'ml/_types/Rule.ts#L52-L65', 'ml._types.RunningStateSearchInterval': 'ml/_types/Datafeed.ts#L153-L156', -'ml._types.TextClassificationInferenceOptions': 'ml/_types/inference.ts#L169-L179', -'ml._types.TextClassificationInferenceUpdateOptions': 'ml/_types/inference.ts#L281-L290', -'ml._types.TextEmbeddingInferenceOptions': 'ml/_types/inference.ts#L212-L218', -'ml._types.TextEmbeddingInferenceUpdateOptions': 'ml/_types/inference.ts#L310-L314', +'ml._types.TextClassificationInferenceOptions': 'ml/_types/inference.ts#L174-L184', +'ml._types.TextClassificationInferenceUpdateOptions': 'ml/_types/inference.ts#L322-L331', +'ml._types.TextEmbeddingInferenceOptions': 'ml/_types/inference.ts#L217-L223', +'ml._types.TextEmbeddingInferenceUpdateOptions': 'ml/_types/inference.ts#L351-L355', 'ml._types.TimingStats': 'ml/_types/DataframeAnalytics.ts#L416-L421', -'ml._types.TokenizationConfigContainer': 'ml/_types/inference.ts#L92-L109', -'ml._types.TokenizationTruncate': 'ml/_types/inference.ts#L268-L272', -'ml._types.TopClassEntry': 'ml/_types/TrainedModel.ts#L370-L374', -'ml._types.TotalFeatureImportance': 'ml/_types/TrainedModel.ts#L222-L229', -'ml._types.TotalFeatureImportanceClass': 'ml/_types/TrainedModel.ts#L231-L236', -'ml._types.TotalFeatureImportanceStatistics': 'ml/_types/TrainedModel.ts#L238-L245', -'ml._types.TrainedModelAllocation': 'ml/_types/TrainedModel.ts#L348-L362', -'ml._types.TrainedModelAllocationRoutingTable': 'ml/_types/TrainedModel.ts#L327-L337', -'ml._types.TrainedModelAllocationTaskParameters': 'ml/_types/TrainedModel.ts#L293-L302', -'ml._types.TrainedModelConfig': 'ml/_types/TrainedModel.ts#L157-L189', -'ml._types.TrainedModelConfigInput': 'ml/_types/TrainedModel.ts#L191-L194', -'ml._types.TrainedModelConfigMetadata': 'ml/_types/TrainedModel.ts#L196-L204', -'ml._types.TrainedModelDeploymentAllocationStatus': 'ml/_types/TrainedModel.ts#L339-L346', -'ml._types.TrainedModelDeploymentNodesStats': 'ml/_types/TrainedModel.ts#L121-L155', +'ml._types.TokenizationConfigContainer': 'ml/_types/inference.ts#L97-L114', +'ml._types.TokenizationTruncate': 'ml/_types/inference.ts#L309-L313', +'ml._types.TopClassEntry': 'ml/_types/inference.ts#L393-L397', +'ml._types.TotalFeatureImportance': 'ml/_types/TrainedModel.ts#L215-L222', +'ml._types.TotalFeatureImportanceClass': 'ml/_types/TrainedModel.ts#L224-L229', +'ml._types.TotalFeatureImportanceStatistics': 'ml/_types/TrainedModel.ts#L231-L238', +'ml._types.TrainedModelAllocation': 'ml/_types/TrainedModel.ts#L341-L355', +'ml._types.TrainedModelAllocationRoutingTable': 'ml/_types/TrainedModel.ts#L320-L330', +'ml._types.TrainedModelAllocationTaskParameters': 'ml/_types/TrainedModel.ts#L286-L295', +'ml._types.TrainedModelConfig': 'ml/_types/TrainedModel.ts#L150-L182', +'ml._types.TrainedModelConfigInput': 'ml/_types/TrainedModel.ts#L184-L187', +'ml._types.TrainedModelConfigMetadata': 'ml/_types/TrainedModel.ts#L189-L197', +'ml._types.TrainedModelDeploymentAllocationStatus': 'ml/_types/TrainedModel.ts#L332-L339', +'ml._types.TrainedModelDeploymentNodesStats': 'ml/_types/TrainedModel.ts#L121-L148', 'ml._types.TrainedModelDeploymentStats': 'ml/_types/TrainedModel.ts#L56-L90', -'ml._types.TrainedModelEntities': 'ml/_types/TrainedModel.ts#L363-L369', +'ml._types.TrainedModelEntities': 'ml/_types/inference.ts#L386-L392', +'ml._types.TrainedModelInferenceClassImportance': 'ml/_types/inference.ts#L399-L402', +'ml._types.TrainedModelInferenceFeatureImportance': 'ml/_types/inference.ts#L404-L408', 'ml._types.TrainedModelInferenceStats': 'ml/_types/TrainedModel.ts#L92-L112', -'ml._types.TrainedModelLocation': 'ml/_types/TrainedModel.ts#L378-L380', -'ml._types.TrainedModelLocationIndex': 'ml/_types/TrainedModel.ts#L382-L384', +'ml._types.TrainedModelLocation': 'ml/_types/TrainedModel.ts#L357-L359', +'ml._types.TrainedModelLocationIndex': 'ml/_types/TrainedModel.ts#L361-L363', 'ml._types.TrainedModelSizeStats': 'ml/_types/TrainedModel.ts#L114-L119', 'ml._types.TrainedModelStats': 'ml/_types/TrainedModel.ts#L36-L54', -'ml._types.TrainedModelType': 'ml/_types/TrainedModel.ts#L247-L261', +'ml._types.TrainedModelType': 'ml/_types/TrainedModel.ts#L240-L254', 'ml._types.ValidationLoss': 'ml/_types/DataframeAnalytics.ts#L423-L428', -'ml._types.ZeroShotClassificationInferenceOptions': 'ml/_types/inference.ts#L181-L202', -'ml._types.ZeroShotClassificationInferenceUpdateOptions': 'ml/_types/inference.ts#L292-L301', +'ml._types.ZeroShotClassificationInferenceOptions': 'ml/_types/inference.ts#L186-L207', +'ml._types.ZeroShotClassificationInferenceUpdateOptions': 'ml/_types/inference.ts#L333-L342', 'ml.close_job.Request': 'ml/close_job/MlCloseJobRequest.ts#L24-L77', 'ml.close_job.Response': 'ml/close_job/MlCloseJobResponse.ts#L20-L22', 'ml.delete_calendar.Request': 'ml/delete_calendar/MlDeleteCalendarRequest.ts#L23-L36', @@ -1746,8 +1758,8 @@ 'ml.get_trained_models.Response': 'ml/get_trained_models/MlGetTrainedModelResponse.ts#L23-L34', 'ml.get_trained_models_stats.Request': 'ml/get_trained_models_stats/MlGetTrainedModelStatsRequest.ts#L24-L64', 'ml.get_trained_models_stats.Response': 'ml/get_trained_models_stats/MlGetTrainedModelStatsResponse.ts#L23-L33', -'ml.infer_trained_model_deployment.Request': 'ml/infer_trained_model_deployment/MlInferTrainedModelDeploymentRequest.ts#L26-L57', -'ml.infer_trained_model_deployment.Response': 'ml/infer_trained_model_deployment/MlInferTrainedModelDeploymentResponse.ts#L27-L65', +'ml.infer_trained_model.Request': 'ml/infer_trained_model/MlInferTrainedModelRequest.ts#L27-L59', +'ml.infer_trained_model.Response': 'ml/infer_trained_model/MlInferTrainedModelResponse.ts#L22-L26', 'ml.info.AnomalyDetectors': 'ml/info/types.ts#L44-L50', 'ml.info.Datafeeds': 'ml/info/types.ts#L40-L42', 'ml.info.Defaults': 'ml/info/types.ts#L24-L27', @@ -1808,7 +1820,7 @@ 'ml.start_data_frame_analytics.Response': 'ml/start_data_frame_analytics/MlStartDataFrameAnalyticsResponse.ts#L22-L28', 'ml.start_datafeed.Request': 'ml/start_datafeed/MlStartDatafeedRequest.ts#L24-L91', 'ml.start_datafeed.Response': 'ml/start_datafeed/MlStartDatafeedResponse.ts#L22-L34', -'ml.start_trained_model_deployment.Request': 'ml/start_trained_model_deployment/MlStartTrainedModelDeploymentRequest.ts#L26-L71', +'ml.start_trained_model_deployment.Request': 'ml/start_trained_model_deployment/MlStartTrainedModelDeploymentRequest.ts#L26-L77', 'ml.start_trained_model_deployment.Response': 'ml/start_trained_model_deployment/MlStartTrainedModelDeploymentResponse.ts#L22-L26', 'ml.stop_data_frame_analytics.Request': 'ml/stop_data_frame_analytics/MlStopDataFrameAnalyticsRequest.ts#L24-L70', 'ml.stop_data_frame_analytics.Response': 'ml/stop_data_frame_analytics/MlStopDataFrameAnalyticsResponse.ts#L20-L22', @@ -2045,10 +2057,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 +2102,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 +2160,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 +2501,10 @@ if (hash.length > 1) { hash = hash.substring(1); } - window.location = "https://github.com/elastic/elasticsearch-specification/tree/4cbdef1d11586b7d6b27d3744dd15a6f0ce96afb/specification/" + (paths[hash] || ""); + window.location = "https://github.com/elastic/elasticsearch-specification/tree/da53b6e6dc15c9a721c96aee24c4d25c0747fd6a/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/enrich/EnrichConfiguration.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/enrich/EnrichConfiguration.java index 49e87c883..849d394ae 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/enrich/EnrichConfiguration.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/enrich/EnrichConfiguration.java @@ -52,12 +52,15 @@ public class EnrichConfiguration implements JsonpSerializable { private final EnrichPolicy match; + private final EnrichPolicy range; + // --------------------------------------------------------------------------------------------- private EnrichConfiguration(Builder builder) { this.geoMatch = builder.geoMatch; this.match = ApiTypeHelper.requireNonNull(builder.match, this, "match"); + this.range = ApiTypeHelper.requireNonNull(builder.range, this, "range"); } @@ -80,6 +83,13 @@ public final EnrichPolicy match() { return this.match; } + /** + * Required - API name: {@code range} + */ + public final EnrichPolicy range() { + return this.range; + } + /** * Serialize this object to JSON. */ @@ -99,6 +109,9 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("match"); this.match.serialize(generator, mapper); + generator.writeKey("range"); + this.range.serialize(generator, mapper); + } @Override @@ -120,6 +133,8 @@ public static class Builder extends WithJsonObjectBuilderBase private EnrichPolicy match; + private EnrichPolicy range; + /** * API name: {@code geo_match} */ @@ -150,6 +165,21 @@ public final Builder match(Function> fn) { + return this.range(fn.apply(new EnrichPolicy.Builder()).build()); + } + @Override protected Builder self() { return this; @@ -180,6 +210,7 @@ protected static void setupEnrichConfigurationDeserializer(ObjectDeserializer implement private String name; + @Nullable + private EnrichPolicy range; + /** * API name: {@code geo_match} */ @@ -179,6 +199,21 @@ public final Builder name(String value) { return this; } + /** + * API name: {@code range} + */ + public final Builder range(@Nullable EnrichPolicy value) { + this.range = value; + return this; + } + + /** + * API name: {@code range} + */ + public final Builder range(Function> fn) { + return this.range(fn.apply(new EnrichPolicy.Builder()).build()); + } + @Override protected Builder self() { return this; @@ -209,6 +244,7 @@ protected static void setupPutPolicyRequestDeserializer(ObjectDeserializer 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/ml/ClassificationInferenceOptions.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ClassificationInferenceOptions.java index 1a949a9c7..68bebe887 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ClassificationInferenceOptions.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ClassificationInferenceOptions.java @@ -52,6 +52,7 @@ @JsonpDeserializable public class ClassificationInferenceOptions implements + InferenceConfigUpdateVariant, InferenceConfigCreateVariant, InferenceConfigVariant, JsonpSerializable { @@ -87,6 +88,14 @@ public static ClassificationInferenceOptions of( return fn.apply(new Builder()).build(); } + /** + * InferenceConfigUpdate variant kind. + */ + @Override + public InferenceConfigUpdate.Kind _inferenceConfigUpdateKind() { + return InferenceConfigUpdate.Kind.Classification; + } + /** * InferenceConfigCreate variant kind. */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ElasticsearchMlAsyncClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ElasticsearchMlAsyncClient.java index 5677663e7..53e64aadc 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ElasticsearchMlAsyncClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ElasticsearchMlAsyncClient.java @@ -1438,20 +1438,19 @@ public CompletableFuture getTrainedModelsStats() GetTrainedModelsStatsRequest._ENDPOINT, this.transportOptions); } - // ----- Endpoint: ml.infer_trained_model_deployment + // ----- Endpoint: ml.infer_trained_model /** * Evaluate a trained model. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/infer-trained-model.html">Documentation * on elastic.co */ - public CompletableFuture inferTrainedModelDeployment( - InferTrainedModelDeploymentRequest request) { + public CompletableFuture inferTrainedModel(InferTrainedModelRequest request) { @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) InferTrainedModelDeploymentRequest._ENDPOINT; + JsonEndpoint endpoint = (JsonEndpoint) InferTrainedModelRequest._ENDPOINT; return this.transport.performRequestAsync(request, endpoint, this.transportOptions); } @@ -1461,15 +1460,15 @@ public CompletableFuture inferTrainedModelD * * @param fn * a function that initializes a builder to create the - * {@link InferTrainedModelDeploymentRequest} + * {@link InferTrainedModelRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/infer-trained-model.html">Documentation * on elastic.co */ - public final CompletableFuture inferTrainedModelDeployment( - Function> fn) { - return inferTrainedModelDeployment(fn.apply(new InferTrainedModelDeploymentRequest.Builder()).build()); + public final CompletableFuture inferTrainedModel( + Function> fn) { + return inferTrainedModel(fn.apply(new InferTrainedModelRequest.Builder()).build()); } // ----- Endpoint: ml.info diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ElasticsearchMlClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ElasticsearchMlClient.java index 9c4e3276e..b3c424588 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ElasticsearchMlClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ElasticsearchMlClient.java @@ -1485,20 +1485,20 @@ public GetTrainedModelsStatsResponse getTrainedModelsStats() throws IOException, GetTrainedModelsStatsRequest._ENDPOINT, this.transportOptions); } - // ----- Endpoint: ml.infer_trained_model_deployment + // ----- Endpoint: ml.infer_trained_model /** * Evaluate a trained model. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/infer-trained-model.html">Documentation * on elastic.co */ - public InferTrainedModelDeploymentResponse inferTrainedModelDeployment(InferTrainedModelDeploymentRequest request) + public InferTrainedModelResponse inferTrainedModel(InferTrainedModelRequest request) throws IOException, ElasticsearchException { @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) InferTrainedModelDeploymentRequest._ENDPOINT; + JsonEndpoint endpoint = (JsonEndpoint) InferTrainedModelRequest._ENDPOINT; return this.transport.performRequest(request, endpoint, this.transportOptions); } @@ -1508,16 +1508,16 @@ public InferTrainedModelDeploymentResponse inferTrainedModelDeployment(InferTrai * * @param fn * a function that initializes a builder to create the - * {@link InferTrainedModelDeploymentRequest} + * {@link InferTrainedModelRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/infer-trained-model.html">Documentation * on elastic.co */ - public final InferTrainedModelDeploymentResponse inferTrainedModelDeployment( - Function> fn) + public final InferTrainedModelResponse inferTrainedModel( + Function> fn) throws IOException, ElasticsearchException { - return inferTrainedModelDeployment(fn.apply(new InferTrainedModelDeploymentRequest.Builder()).build()); + return inferTrainedModel(fn.apply(new InferTrainedModelRequest.Builder()).build()); } // ----- Endpoint: ml.info diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/FillMaskInferenceUpdateOptions.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/FillMaskInferenceUpdateOptions.java index 1d1c63db4..bb8a2832d 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/FillMaskInferenceUpdateOptions.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/FillMaskInferenceUpdateOptions.java @@ -48,7 +48,7 @@ * specification */ @JsonpDeserializable -public class FillMaskInferenceUpdateOptions implements NlpInferenceConfigUpdateVariant, JsonpSerializable { +public class FillMaskInferenceUpdateOptions implements InferenceConfigUpdateVariant, JsonpSerializable { @Nullable private final Integer numTopClasses; @@ -74,11 +74,11 @@ public static FillMaskInferenceUpdateOptions of( } /** - * NlpInferenceConfigUpdate variant kind. + * InferenceConfigUpdate variant kind. */ @Override - public NlpInferenceConfigUpdate.Kind _nlpInferenceConfigUpdateKind() { - return NlpInferenceConfigUpdate.Kind.FillMask; + public InferenceConfigUpdate.Kind _inferenceConfigUpdateKind() { + return InferenceConfigUpdate.Kind.FillMask; } /** diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/InferTrainedModelDeploymentRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/InferTrainedModelRequest.java similarity index 67% rename from java-client/src/main/java/co/elastic/clients/elasticsearch/ml/InferTrainedModelDeploymentRequest.java rename to java-client/src/main/java/co/elastic/clients/elasticsearch/ml/InferTrainedModelRequest.java index 325177f31..71e8b6ec1 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/InferTrainedModelDeploymentRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/InferTrainedModelRequest.java @@ -26,6 +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.json.JsonData; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -46,21 +47,20 @@ import java.util.function.Function; import javax.annotation.Nullable; -// typedef: ml.infer_trained_model_deployment.Request +// typedef: ml.infer_trained_model.Request /** * Evaluates a trained model. * - * @see API + * @see API * specification */ @JsonpDeserializable -public class InferTrainedModelDeploymentRequest extends RequestBase implements JsonpSerializable { - private final List> docs; +public class InferTrainedModelRequest extends RequestBase implements JsonpSerializable { + private final List> docs; @Nullable - private final NlpInferenceConfigUpdate inferenceConfig; + private final InferenceConfigUpdate inferenceConfig; private final String modelId; @@ -69,7 +69,7 @@ public class InferTrainedModelDeploymentRequest extends RequestBase implements J // --------------------------------------------------------------------------------------------- - private InferTrainedModelDeploymentRequest(Builder builder) { + private InferTrainedModelRequest(Builder builder) { this.docs = ApiTypeHelper.unmodifiableRequired(builder.docs, this, "docs"); this.inferenceConfig = builder.inferenceConfig; @@ -78,20 +78,19 @@ private InferTrainedModelDeploymentRequest(Builder builder) { } - public static InferTrainedModelDeploymentRequest of( - Function> fn) { + public static InferTrainedModelRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - An array of objects to pass to the model for inference. The - * objects should contain a field matching your configured trained model input. - * Typically, the field name is text_field. Currently, only a - * single value is allowed. + * objects should contain a fields matching your configured trained model input. + * Typically, for NLP models, the field name is text_field. + * Currently, for NLP models, only a single value is allowed. *

* API name: {@code docs} */ - public final List> docs() { + public final List> docs() { return this.docs; } @@ -101,7 +100,7 @@ public final List> docs() { * API name: {@code inference_config} */ @Nullable - public final NlpInferenceConfigUpdate inferenceConfig() { + public final InferenceConfigUpdate inferenceConfig() { return this.inferenceConfig; } @@ -138,12 +137,12 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (ApiTypeHelper.isDefined(this.docs)) { generator.writeKey("docs"); generator.writeStartArray(); - for (Map item0 : this.docs) { + for (Map item0 : this.docs) { generator.writeStartObject(); if (item0 != null) { - for (Map.Entry item1 : item0.entrySet()) { + for (Map.Entry item1 : item0.entrySet()) { generator.writeKey(item1.getKey()); - generator.write(item1.getValue()); + item1.getValue().serialize(generator, mapper); } } @@ -164,16 +163,16 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { // --------------------------------------------------------------------------------------------- /** - * Builder for {@link InferTrainedModelDeploymentRequest}. + * Builder for {@link InferTrainedModelRequest}. */ public static class Builder extends WithJsonObjectBuilderBase implements - ObjectBuilder { - private List> docs; + ObjectBuilder { + private List> docs; @Nullable - private NlpInferenceConfigUpdate inferenceConfig; + private InferenceConfigUpdate inferenceConfig; private String modelId; @@ -182,30 +181,30 @@ public static class Builder extends WithJsonObjectBuilderBase /** * Required - An array of objects to pass to the model for inference. The - * objects should contain a field matching your configured trained model input. - * Typically, the field name is text_field. Currently, only a - * single value is allowed. + * objects should contain a fields matching your configured trained model input. + * Typically, for NLP models, the field name is text_field. + * Currently, for NLP models, only a single value is allowed. *

* API name: {@code docs} *

* Adds all elements of list to docs. */ - public final Builder docs(List> list) { + public final Builder docs(List> list) { this.docs = _listAddAll(this.docs, list); return this; } /** * Required - An array of objects to pass to the model for inference. The - * objects should contain a field matching your configured trained model input. - * Typically, the field name is text_field. Currently, only a - * single value is allowed. + * objects should contain a fields matching your configured trained model input. + * Typically, for NLP models, the field name is text_field. + * Currently, for NLP models, only a single value is allowed. *

* API name: {@code docs} *

* Adds one or more values to docs. */ - public final Builder docs(Map value, Map... values) { + public final Builder docs(Map value, Map... values) { this.docs = _listAdd(this.docs, value, values); return this; } @@ -215,7 +214,7 @@ public final Builder docs(Map value, Map... valu *

* API name: {@code inference_config} */ - public final Builder inferenceConfig(@Nullable NlpInferenceConfigUpdate value) { + public final Builder inferenceConfig(@Nullable InferenceConfigUpdate value) { this.inferenceConfig = value; return this; } @@ -226,8 +225,8 @@ public final Builder inferenceConfig(@Nullable NlpInferenceConfigUpdate value) { * API name: {@code inference_config} */ public final Builder inferenceConfig( - Function> fn) { - return this.inferenceConfig(fn.apply(new NlpInferenceConfigUpdate.Builder()).build()); + Function> fn) { + return this.inferenceConfig(fn.apply(new InferenceConfigUpdate.Builder()).build()); } /** @@ -265,43 +264,43 @@ protected Builder self() { } /** - * Builds a {@link InferTrainedModelDeploymentRequest}. + * Builds a {@link InferTrainedModelRequest}. * * @throws NullPointerException * if some of the required fields are null. */ - public InferTrainedModelDeploymentRequest build() { + public InferTrainedModelRequest build() { _checkSingleUse(); - return new InferTrainedModelDeploymentRequest(this); + return new InferTrainedModelRequest(this); } } // --------------------------------------------------------------------------------------------- /** - * Json deserializer for {@link InferTrainedModelDeploymentRequest} + * Json deserializer for {@link InferTrainedModelRequest} */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, - InferTrainedModelDeploymentRequest::setupInferTrainedModelDeploymentRequestDeserializer); + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, InferTrainedModelRequest::setupInferTrainedModelRequestDeserializer); - protected static void setupInferTrainedModelDeploymentRequestDeserializer( - ObjectDeserializer op) { + protected static void setupInferTrainedModelRequestDeserializer( + ObjectDeserializer op) { - op.add(Builder::docs, JsonpDeserializer.arrayDeserializer( - JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer())), "docs"); - op.add(Builder::inferenceConfig, NlpInferenceConfigUpdate._DESERIALIZER, "inference_config"); + op.add(Builder::docs, + JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER)), + "docs"); + op.add(Builder::inferenceConfig, InferenceConfigUpdate._DESERIALIZER, "inference_config"); } // --------------------------------------------------------------------------------------------- /** - * Endpoint "{@code ml.infer_trained_model_deployment}". + * Endpoint "{@code ml.infer_trained_model}". */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - "es/ml.infer_trained_model_deployment", + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/ml.infer_trained_model", // Request method request -> { @@ -317,6 +316,15 @@ protected static void setupInferTrainedModelDeploymentRequestDeserializer( propsSet |= _modelId; + if (propsSet == (_modelId)) { + StringBuilder buf = new StringBuilder(); + buf.append("/_ml"); + buf.append("/trained_models"); + buf.append("/"); + SimpleEndpoint.pathEncode(request.modelId, buf); + buf.append("/_infer"); + return buf.toString(); + } if (propsSet == (_modelId)) { StringBuilder buf = new StringBuilder(); buf.append("/_ml"); @@ -339,5 +347,5 @@ protected static void setupInferTrainedModelDeploymentRequestDeserializer( } return params; - }, SimpleEndpoint.emptyMap(), true, InferTrainedModelDeploymentResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), true, InferTrainedModelResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/InferTrainedModelResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/InferTrainedModelResponse.java new file mode 100644 index 000000000..1ebff6968 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/InferTrainedModelResponse.java @@ -0,0 +1,176 @@ +/* + * 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.ml; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpUtils; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.WithJsonObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.util.List; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: ml.infer_trained_model.Response + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class InferTrainedModelResponse implements JsonpSerializable { + private final List inferenceResults; + + // --------------------------------------------------------------------------------------------- + + private InferTrainedModelResponse(Builder builder) { + + this.inferenceResults = ApiTypeHelper.unmodifiableRequired(builder.inferenceResults, this, "inferenceResults"); + + } + + public static InferTrainedModelResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code inference_results} + */ + public final List inferenceResults() { + return this.inferenceResults; + } + + /** + * 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.inferenceResults)) { + generator.writeKey("inference_results"); + generator.writeStartArray(); + for (InferenceResponseResult item0 : this.inferenceResults) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link InferTrainedModelResponse}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private List inferenceResults; + + /** + * Required - API name: {@code inference_results} + *

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

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

+ * Adds a value to inferenceResults using a builder lambda. + */ + public final Builder inferenceResults( + Function> fn) { + return inferenceResults(fn.apply(new InferenceResponseResult.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link InferTrainedModelResponse}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public InferTrainedModelResponse build() { + _checkSingleUse(); + + return new InferTrainedModelResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link InferTrainedModelResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, InferTrainedModelResponse::setupInferTrainedModelResponseDeserializer); + + protected static void setupInferTrainedModelResponseDeserializer( + ObjectDeserializer op) { + + op.add(Builder::inferenceResults, JsonpDeserializer.arrayDeserializer(InferenceResponseResult._DESERIALIZER), + "inference_results"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/InferenceConfigCreate.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/InferenceConfigCreate.java index 75c17239a..a7b44605e 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/InferenceConfigCreate.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/InferenceConfigCreate.java @@ -81,6 +81,8 @@ public enum Kind implements JsonEnum { TextEmbedding("text_embedding"), + QuestionAnswering("question_answering"), + ; private final String jsonValue; @@ -264,6 +266,24 @@ public TextEmbeddingInferenceOptions textEmbedding() { return TaggedUnionUtils.get(this, Kind.TextEmbedding); } + /** + * Is this variant instance of kind {@code question_answering}? + */ + public boolean isQuestionAnswering() { + return _kind == Kind.QuestionAnswering; + } + + /** + * Get the {@code question_answering} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code question_answering} + * kind. + */ + public QuestionAnsweringInferenceOptions questionAnswering() { + return TaggedUnionUtils.get(this, Kind.QuestionAnswering); + } + @Override @SuppressWarnings("unchecked") public void serialize(JsonGenerator generator, JsonpMapper mapper) { @@ -377,6 +397,17 @@ public ObjectBuilder textEmbedding( return this.textEmbedding(fn.apply(new TextEmbeddingInferenceOptions.Builder()).build()); } + public ObjectBuilder questionAnswering(QuestionAnsweringInferenceOptions v) { + this._kind = Kind.QuestionAnswering; + this._value = v; + return this; + } + + public ObjectBuilder questionAnswering( + Function> fn) { + return this.questionAnswering(fn.apply(new QuestionAnsweringInferenceOptions.Builder()).build()); + } + public InferenceConfigCreate build() { _checkSingleUse(); return new InferenceConfigCreate(this); @@ -395,6 +426,7 @@ protected static void setupInferenceConfigCreateDeserializer(ObjectDeserializer< op.add(Builder::ner, NerInferenceOptions._DESERIALIZER, "ner"); op.add(Builder::passThrough, PassThroughInferenceOptions._DESERIALIZER, "pass_through"); op.add(Builder::textEmbedding, TextEmbeddingInferenceOptions._DESERIALIZER, "text_embedding"); + op.add(Builder::questionAnswering, QuestionAnsweringInferenceOptions._DESERIALIZER, "question_answering"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/InferenceConfigCreateBuilders.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/InferenceConfigCreateBuilders.java index 650339de0..a4dcc67bb 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/InferenceConfigCreateBuilders.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/InferenceConfigCreateBuilders.java @@ -187,4 +187,24 @@ public static InferenceConfigCreate textEmbedding( return builder.build(); } + /** + * Creates a builder for the {@link QuestionAnsweringInferenceOptions + * question_answering} {@code InferenceConfigCreate} variant. + */ + public static QuestionAnsweringInferenceOptions.Builder questionAnswering() { + return new QuestionAnsweringInferenceOptions.Builder(); + } + + /** + * Creates a InferenceConfigCreate of the + * {@link QuestionAnsweringInferenceOptions question_answering} + * {@code InferenceConfigCreate} variant. + */ + public static InferenceConfigCreate questionAnswering( + Function> fn) { + InferenceConfigCreate.Builder builder = new InferenceConfigCreate.Builder(); + builder.questionAnswering(fn.apply(new QuestionAnsweringInferenceOptions.Builder()).build()); + return builder.build(); + } + } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/NlpInferenceConfigUpdate.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/InferenceConfigUpdate.java similarity index 62% rename from java-client/src/main/java/co/elastic/clients/elasticsearch/ml/NlpInferenceConfigUpdate.java rename to java-client/src/main/java/co/elastic/clients/elasticsearch/ml/InferenceConfigUpdate.java index 49265cc15..35b807cab 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/NlpInferenceConfigUpdate.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/InferenceConfigUpdate.java @@ -41,29 +41,33 @@ import java.util.function.Function; import javax.annotation.Nullable; -// typedef: ml._types.NlpInferenceConfigUpdateContainer +// typedef: ml._types.InferenceConfigUpdateContainer /** * * @see API + * "../doc-files/api-spec.html#ml._types.InferenceConfigUpdateContainer">API * specification */ @JsonpDeserializable -public class NlpInferenceConfigUpdate implements TaggedUnion, JsonpSerializable { +public class InferenceConfigUpdate implements TaggedUnion, JsonpSerializable { /** - * {@link NlpInferenceConfigUpdate} variant kinds. + * {@link InferenceConfigUpdate} variant kinds. */ /** - * {@link NlpInferenceConfigUpdate} variant kinds. + * {@link InferenceConfigUpdate} variant kinds. * * @see API + * "../doc-files/api-spec.html#ml._types.InferenceConfigUpdateContainer">API * specification */ public enum Kind implements JsonEnum { + Regression("regression"), + + Classification("classification"), + TextClassification("text_classification"), ZeroShotClassification("zero_shot_classification"), @@ -76,6 +80,8 @@ public enum Kind implements JsonEnum { TextEmbedding("text_embedding"), + QuestionAnswering("question_answering"), + ; private final String jsonValue; @@ -103,24 +109,58 @@ public final Object _get() { return _value; } - public NlpInferenceConfigUpdate(NlpInferenceConfigUpdateVariant value) { + public InferenceConfigUpdate(InferenceConfigUpdateVariant value) { - this._kind = ApiTypeHelper.requireNonNull(value._nlpInferenceConfigUpdateKind(), this, ""); + this._kind = ApiTypeHelper.requireNonNull(value._inferenceConfigUpdateKind(), this, ""); this._value = ApiTypeHelper.requireNonNull(value, this, ""); } - private NlpInferenceConfigUpdate(Builder builder) { + private InferenceConfigUpdate(Builder builder) { this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); } - public static NlpInferenceConfigUpdate of(Function> fn) { + public static InferenceConfigUpdate of(Function> fn) { return fn.apply(new Builder()).build(); } + /** + * Is this variant instance of kind {@code regression}? + */ + public boolean isRegression() { + return _kind == Kind.Regression; + } + + /** + * Get the {@code regression} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code regression} kind. + */ + public RegressionInferenceOptions regression() { + return TaggedUnionUtils.get(this, Kind.Regression); + } + + /** + * Is this variant instance of kind {@code classification}? + */ + public boolean isClassification() { + return _kind == Kind.Classification; + } + + /** + * Get the {@code classification} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code classification} kind. + */ + public ClassificationInferenceOptions classification() { + return TaggedUnionUtils.get(this, Kind.Classification); + } + /** * Is this variant instance of kind {@code text_classification}? */ @@ -225,6 +265,24 @@ public TextEmbeddingInferenceUpdateOptions textEmbedding() { return TaggedUnionUtils.get(this, Kind.TextEmbedding); } + /** + * Is this variant instance of kind {@code question_answering}? + */ + public boolean isQuestionAnswering() { + return _kind == Kind.QuestionAnswering; + } + + /** + * Get the {@code question_answering} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code question_answering} + * kind. + */ + public QuestionAnsweringInferenceUpdateOptions questionAnswering() { + return TaggedUnionUtils.get(this, Kind.QuestionAnswering); + } + @Override @SuppressWarnings("unchecked") public void serialize(JsonGenerator generator, JsonpMapper mapper) { @@ -242,7 +300,7 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { public static class Builder extends WithJsonObjectBuilderBase implements - ObjectBuilder { + ObjectBuilder { private Kind _kind; private Object _value; @@ -250,83 +308,118 @@ public static class Builder extends WithJsonObjectBuilderBase protected Builder self() { return this; } - public ObjectBuilder textClassification(TextClassificationInferenceUpdateOptions v) { + public ObjectBuilder regression(RegressionInferenceOptions v) { + this._kind = Kind.Regression; + this._value = v; + return this; + } + + public ObjectBuilder regression( + Function> fn) { + return this.regression(fn.apply(new RegressionInferenceOptions.Builder()).build()); + } + + public ObjectBuilder classification(ClassificationInferenceOptions v) { + this._kind = Kind.Classification; + this._value = v; + return this; + } + + public ObjectBuilder classification( + Function> fn) { + return this.classification(fn.apply(new ClassificationInferenceOptions.Builder()).build()); + } + + public ObjectBuilder textClassification(TextClassificationInferenceUpdateOptions v) { this._kind = Kind.TextClassification; this._value = v; return this; } - public ObjectBuilder textClassification( + public ObjectBuilder textClassification( Function> fn) { return this.textClassification(fn.apply(new TextClassificationInferenceUpdateOptions.Builder()).build()); } - public ObjectBuilder zeroShotClassification( + public ObjectBuilder zeroShotClassification( ZeroShotClassificationInferenceUpdateOptions v) { this._kind = Kind.ZeroShotClassification; this._value = v; return this; } - public ObjectBuilder zeroShotClassification( + public ObjectBuilder zeroShotClassification( Function> fn) { return this.zeroShotClassification( fn.apply(new ZeroShotClassificationInferenceUpdateOptions.Builder()).build()); } - public ObjectBuilder fillMask(FillMaskInferenceUpdateOptions v) { + public ObjectBuilder fillMask(FillMaskInferenceUpdateOptions v) { this._kind = Kind.FillMask; this._value = v; return this; } - public ObjectBuilder fillMask( + public ObjectBuilder fillMask( Function> fn) { return this.fillMask(fn.apply(new FillMaskInferenceUpdateOptions.Builder()).build()); } - public ObjectBuilder ner(NerInferenceUpdateOptions v) { + public ObjectBuilder ner(NerInferenceUpdateOptions v) { this._kind = Kind.Ner; this._value = v; return this; } - public ObjectBuilder ner( + public ObjectBuilder ner( Function> fn) { return this.ner(fn.apply(new NerInferenceUpdateOptions.Builder()).build()); } - public ObjectBuilder passThrough(PassThroughInferenceUpdateOptions v) { + public ObjectBuilder passThrough(PassThroughInferenceUpdateOptions v) { this._kind = Kind.PassThrough; this._value = v; return this; } - public ObjectBuilder passThrough( + public ObjectBuilder passThrough( Function> fn) { return this.passThrough(fn.apply(new PassThroughInferenceUpdateOptions.Builder()).build()); } - public ObjectBuilder textEmbedding(TextEmbeddingInferenceUpdateOptions v) { + public ObjectBuilder textEmbedding(TextEmbeddingInferenceUpdateOptions v) { this._kind = Kind.TextEmbedding; this._value = v; return this; } - public ObjectBuilder textEmbedding( + public ObjectBuilder textEmbedding( Function> fn) { return this.textEmbedding(fn.apply(new TextEmbeddingInferenceUpdateOptions.Builder()).build()); } - public NlpInferenceConfigUpdate build() { + public ObjectBuilder questionAnswering(QuestionAnsweringInferenceUpdateOptions v) { + this._kind = Kind.QuestionAnswering; + this._value = v; + return this; + } + + public ObjectBuilder questionAnswering( + Function> fn) { + return this.questionAnswering(fn.apply(new QuestionAnsweringInferenceUpdateOptions.Builder()).build()); + } + + public InferenceConfigUpdate build() { _checkSingleUse(); - return new NlpInferenceConfigUpdate(this); + return new InferenceConfigUpdate(this); } } - protected static void setupNlpInferenceConfigUpdateDeserializer(ObjectDeserializer op) { + protected static void setupInferenceConfigUpdateDeserializer(ObjectDeserializer op) { + op.add(Builder::regression, RegressionInferenceOptions._DESERIALIZER, "regression"); + op.add(Builder::classification, ClassificationInferenceOptions._DESERIALIZER, "classification"); op.add(Builder::textClassification, TextClassificationInferenceUpdateOptions._DESERIALIZER, "text_classification"); op.add(Builder::zeroShotClassification, ZeroShotClassificationInferenceUpdateOptions._DESERIALIZER, @@ -335,9 +428,10 @@ protected static void setupNlpInferenceConfigUpdateDeserializer(ObjectDeserializ op.add(Builder::ner, NerInferenceUpdateOptions._DESERIALIZER, "ner"); op.add(Builder::passThrough, PassThroughInferenceUpdateOptions._DESERIALIZER, "pass_through"); op.add(Builder::textEmbedding, TextEmbeddingInferenceUpdateOptions._DESERIALIZER, "text_embedding"); + op.add(Builder::questionAnswering, QuestionAnsweringInferenceUpdateOptions._DESERIALIZER, "question_answering"); } - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, NlpInferenceConfigUpdate::setupNlpInferenceConfigUpdateDeserializer, Builder::build); + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, InferenceConfigUpdate::setupInferenceConfigUpdateDeserializer, Builder::build); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/InferenceConfigUpdateBuilders.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/InferenceConfigUpdateBuilders.java new file mode 100644 index 000000000..fe1e8369a --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/InferenceConfigUpdateBuilders.java @@ -0,0 +1,212 @@ +/* + * 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.ml; + +import co.elastic.clients.util.ObjectBuilder; +import java.util.function.Function; + +/** + * Builders for {@link InferenceConfigUpdate} variants. + */ +public class InferenceConfigUpdateBuilders { + private InferenceConfigUpdateBuilders() { + } + + /** + * Creates a builder for the {@link RegressionInferenceOptions regression} + * {@code InferenceConfigUpdate} variant. + */ + public static RegressionInferenceOptions.Builder regression() { + return new RegressionInferenceOptions.Builder(); + } + + /** + * Creates a InferenceConfigUpdate of the {@link RegressionInferenceOptions + * regression} {@code InferenceConfigUpdate} variant. + */ + public static InferenceConfigUpdate regression( + Function> fn) { + InferenceConfigUpdate.Builder builder = new InferenceConfigUpdate.Builder(); + builder.regression(fn.apply(new RegressionInferenceOptions.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link ClassificationInferenceOptions + * classification} {@code InferenceConfigUpdate} variant. + */ + public static ClassificationInferenceOptions.Builder classification() { + return new ClassificationInferenceOptions.Builder(); + } + + /** + * Creates a InferenceConfigUpdate of the {@link ClassificationInferenceOptions + * classification} {@code InferenceConfigUpdate} variant. + */ + public static InferenceConfigUpdate classification( + Function> fn) { + InferenceConfigUpdate.Builder builder = new InferenceConfigUpdate.Builder(); + builder.classification(fn.apply(new ClassificationInferenceOptions.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link TextClassificationInferenceUpdateOptions + * text_classification} {@code InferenceConfigUpdate} variant. + */ + public static TextClassificationInferenceUpdateOptions.Builder textClassification() { + return new TextClassificationInferenceUpdateOptions.Builder(); + } + + /** + * Creates a InferenceConfigUpdate of the + * {@link TextClassificationInferenceUpdateOptions text_classification} + * {@code InferenceConfigUpdate} variant. + */ + public static InferenceConfigUpdate textClassification( + Function> fn) { + InferenceConfigUpdate.Builder builder = new InferenceConfigUpdate.Builder(); + builder.textClassification(fn.apply(new TextClassificationInferenceUpdateOptions.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link ZeroShotClassificationInferenceUpdateOptions + * zero_shot_classification} {@code InferenceConfigUpdate} variant. + */ + public static ZeroShotClassificationInferenceUpdateOptions.Builder zeroShotClassification() { + return new ZeroShotClassificationInferenceUpdateOptions.Builder(); + } + + /** + * Creates a InferenceConfigUpdate of the + * {@link ZeroShotClassificationInferenceUpdateOptions zero_shot_classification} + * {@code InferenceConfigUpdate} variant. + */ + public static InferenceConfigUpdate zeroShotClassification( + Function> fn) { + InferenceConfigUpdate.Builder builder = new InferenceConfigUpdate.Builder(); + builder.zeroShotClassification(fn.apply(new ZeroShotClassificationInferenceUpdateOptions.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link FillMaskInferenceUpdateOptions fill_mask} + * {@code InferenceConfigUpdate} variant. + */ + public static FillMaskInferenceUpdateOptions.Builder fillMask() { + return new FillMaskInferenceUpdateOptions.Builder(); + } + + /** + * Creates a InferenceConfigUpdate of the {@link FillMaskInferenceUpdateOptions + * fill_mask} {@code InferenceConfigUpdate} variant. + */ + public static InferenceConfigUpdate fillMask( + Function> fn) { + InferenceConfigUpdate.Builder builder = new InferenceConfigUpdate.Builder(); + builder.fillMask(fn.apply(new FillMaskInferenceUpdateOptions.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link NerInferenceUpdateOptions ner} + * {@code InferenceConfigUpdate} variant. + */ + public static NerInferenceUpdateOptions.Builder ner() { + return new NerInferenceUpdateOptions.Builder(); + } + + /** + * Creates a InferenceConfigUpdate of the {@link NerInferenceUpdateOptions ner} + * {@code InferenceConfigUpdate} variant. + */ + public static InferenceConfigUpdate ner( + Function> fn) { + InferenceConfigUpdate.Builder builder = new InferenceConfigUpdate.Builder(); + builder.ner(fn.apply(new NerInferenceUpdateOptions.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link PassThroughInferenceUpdateOptions + * pass_through} {@code InferenceConfigUpdate} variant. + */ + public static PassThroughInferenceUpdateOptions.Builder passThrough() { + return new PassThroughInferenceUpdateOptions.Builder(); + } + + /** + * Creates a InferenceConfigUpdate of the + * {@link PassThroughInferenceUpdateOptions pass_through} + * {@code InferenceConfigUpdate} variant. + */ + public static InferenceConfigUpdate passThrough( + Function> fn) { + InferenceConfigUpdate.Builder builder = new InferenceConfigUpdate.Builder(); + builder.passThrough(fn.apply(new PassThroughInferenceUpdateOptions.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link TextEmbeddingInferenceUpdateOptions + * text_embedding} {@code InferenceConfigUpdate} variant. + */ + public static TextEmbeddingInferenceUpdateOptions.Builder textEmbedding() { + return new TextEmbeddingInferenceUpdateOptions.Builder(); + } + + /** + * Creates a InferenceConfigUpdate of the + * {@link TextEmbeddingInferenceUpdateOptions text_embedding} + * {@code InferenceConfigUpdate} variant. + */ + public static InferenceConfigUpdate textEmbedding( + Function> fn) { + InferenceConfigUpdate.Builder builder = new InferenceConfigUpdate.Builder(); + builder.textEmbedding(fn.apply(new TextEmbeddingInferenceUpdateOptions.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link QuestionAnsweringInferenceUpdateOptions + * question_answering} {@code InferenceConfigUpdate} variant. + */ + public static QuestionAnsweringInferenceUpdateOptions.Builder questionAnswering() { + return new QuestionAnsweringInferenceUpdateOptions.Builder(); + } + + /** + * Creates a InferenceConfigUpdate of the + * {@link QuestionAnsweringInferenceUpdateOptions question_answering} + * {@code InferenceConfigUpdate} variant. + */ + public static InferenceConfigUpdate questionAnswering( + Function> fn) { + InferenceConfigUpdate.Builder builder = new InferenceConfigUpdate.Builder(); + builder.questionAnswering(fn.apply(new QuestionAnsweringInferenceUpdateOptions.Builder()).build()); + return builder.build(); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/NlpInferenceConfigUpdateVariant.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/InferenceConfigUpdateVariant.java similarity index 77% rename from java-client/src/main/java/co/elastic/clients/elasticsearch/ml/NlpInferenceConfigUpdateVariant.java rename to java-client/src/main/java/co/elastic/clients/elasticsearch/ml/InferenceConfigUpdateVariant.java index 3231f2127..6cdcfd4a0 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/NlpInferenceConfigUpdateVariant.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/InferenceConfigUpdateVariant.java @@ -24,14 +24,14 @@ package co.elastic.clients.elasticsearch.ml; /** - * Base interface for {@link NlpInferenceConfigUpdate} variants. + * Base interface for {@link InferenceConfigUpdate} variants. */ -public interface NlpInferenceConfigUpdateVariant { +public interface InferenceConfigUpdateVariant { - NlpInferenceConfigUpdate.Kind _nlpInferenceConfigUpdateKind(); + InferenceConfigUpdate.Kind _inferenceConfigUpdateKind(); - default NlpInferenceConfigUpdate _toNlpInferenceConfigUpdate() { - return new NlpInferenceConfigUpdate(this); + default InferenceConfigUpdate _toInferenceConfigUpdate() { + return new InferenceConfigUpdate(this); } } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/InferTrainedModelDeploymentResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/InferenceResponseResult.java similarity index 63% rename from java-client/src/main/java/co/elastic/clients/elasticsearch/ml/InferTrainedModelDeploymentResponse.java rename to java-client/src/main/java/co/elastic/clients/elasticsearch/ml/InferenceResponseResult.java index 3324f241a..60c09eb19 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/InferTrainedModelDeploymentResponse.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/InferenceResponseResult.java @@ -23,6 +23,7 @@ package co.elastic.clients.elasticsearch.ml; +import co.elastic.clients.elasticsearch._types.FieldValue; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -42,22 +43,22 @@ import java.util.function.Function; import javax.annotation.Nullable; -// typedef: ml.infer_trained_model_deployment.Response +// typedef: ml._types.InferenceResponseResult /** * * @see API + * "../doc-files/api-spec.html#ml._types.InferenceResponseResult">API * specification */ @JsonpDeserializable -public class InferTrainedModelDeploymentResponse implements JsonpSerializable { +public class InferenceResponseResult implements JsonpSerializable { private final List entities; @Nullable private final Boolean isTruncated; - private final List predictedValue; + private final List predictedValue; @Nullable private final String predictedValueSequence; @@ -65,27 +66,33 @@ public class InferTrainedModelDeploymentResponse implements JsonpSerializable { @Nullable private final Double predictionProbability; + @Nullable + private final Double predictionScore; + private final List topClasses; @Nullable private final String warning; + private final List featureImportance; + // --------------------------------------------------------------------------------------------- - private InferTrainedModelDeploymentResponse(Builder builder) { + private InferenceResponseResult(Builder builder) { this.entities = ApiTypeHelper.unmodifiable(builder.entities); this.isTruncated = builder.isTruncated; this.predictedValue = ApiTypeHelper.unmodifiable(builder.predictedValue); this.predictedValueSequence = builder.predictedValueSequence; this.predictionProbability = builder.predictionProbability; - this.topClasses = ApiTypeHelper.unmodifiableRequired(builder.topClasses, this, "topClasses"); + this.predictionScore = builder.predictionScore; + this.topClasses = ApiTypeHelper.unmodifiable(builder.topClasses); this.warning = builder.warning; + this.featureImportance = ApiTypeHelper.unmodifiable(builder.featureImportance); } - public static InferTrainedModelDeploymentResponse of( - Function> fn) { + public static InferenceResponseResult of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -115,17 +122,19 @@ public final Boolean isTruncated() { * task, the response is the predicted class. For named entity recognition (NER) * tasks, it contains the annotated text output. For fill mask tasks, it * contains the top prediction for replacing the mask token. For text embedding - * tasks, it contains the raw numerical text embedding values. + * tasks, it contains the raw numerical text embedding values. For regression + * models, its a numerical value For classification models, it may be an + * integer, double, boolean or string depending on prediction type *

* API name: {@code predicted_value} */ - public final List predictedValue() { + public final List predictedValue() { return this.predictedValue; } /** * For fill mask tasks, the response contains the input text sequence with the - * mask token replaced by the predicted value. + * mask token replaced by the predicted value. Additionally *

* API name: {@code predicted_value_sequence} */ @@ -135,7 +144,7 @@ public final String predictedValueSequence() { } /** - * Specifies a confidence score for the predicted value. + * Specifies a probability for the predicted value. *

* API name: {@code prediction_probability} */ @@ -145,8 +154,18 @@ public final Double predictionProbability() { } /** - * Required - For fill mask, text classification, and zero shot classification - * tasks, the response contains a list of top class entries. + * Specifies a confidence score for the predicted value. + *

+ * API name: {@code prediction_score} + */ + @Nullable + public final Double predictionScore() { + return this.predictionScore; + } + + /** + * For fill mask, text classification, and zero shot classification tasks, the + * response contains a list of top class entries. *

* API name: {@code top_classes} */ @@ -164,6 +183,16 @@ public final String warning() { return this.warning; } + /** + * The feature importance for the inference results. Relevant only for + * classification or regression models + *

+ * API name: {@code feature_importance} + */ + public final List featureImportance() { + return this.featureImportance; + } + /** * Serialize this object to JSON. */ @@ -193,8 +222,8 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (ApiTypeHelper.isDefined(this.predictedValue)) { generator.writeKey("predicted_value"); generator.writeStartArray(); - for (String item0 : this.predictedValue) { - generator.write(item0); + for (FieldValue item0 : this.predictedValue) { + item0.serialize(generator, mapper); } generator.writeEnd(); @@ -209,6 +238,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("prediction_probability"); generator.write(this.predictionProbability); + } + if (this.predictionScore != null) { + generator.writeKey("prediction_score"); + generator.write(this.predictionScore); + } if (ApiTypeHelper.isDefined(this.topClasses)) { generator.writeKey("top_classes"); @@ -225,6 +259,16 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.warning); } + if (ApiTypeHelper.isDefined(this.featureImportance)) { + generator.writeKey("feature_importance"); + generator.writeStartArray(); + for (TrainedModelInferenceFeatureImportance item0 : this.featureImportance) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } } @@ -236,12 +280,12 @@ public String toString() { // --------------------------------------------------------------------------------------------- /** - * Builder for {@link InferTrainedModelDeploymentResponse}. + * Builder for {@link InferenceResponseResult}. */ public static class Builder extends WithJsonObjectBuilderBase implements - ObjectBuilder { + ObjectBuilder { @Nullable private List entities; @@ -249,7 +293,7 @@ public static class Builder extends WithJsonObjectBuilderBase private Boolean isTruncated; @Nullable - private List predictedValue; + private List predictedValue; @Nullable private String predictedValueSequence; @@ -257,11 +301,18 @@ public static class Builder extends WithJsonObjectBuilderBase @Nullable private Double predictionProbability; + @Nullable + private Double predictionScore; + + @Nullable private List topClasses; @Nullable private String warning; + @Nullable + private List featureImportance; + /** * If the model is trained for named entity recognition (NER) tasks, the * response contains the recognized entities. @@ -316,13 +367,15 @@ public final Builder isTruncated(@Nullable Boolean value) { * task, the response is the predicted class. For named entity recognition (NER) * tasks, it contains the annotated text output. For fill mask tasks, it * contains the top prediction for replacing the mask token. For text embedding - * tasks, it contains the raw numerical text embedding values. + * tasks, it contains the raw numerical text embedding values. For regression + * models, its a numerical value For classification models, it may be an + * integer, double, boolean or string depending on prediction type *

* API name: {@code predicted_value} *

* Adds all elements of list to predictedValue. */ - public final Builder predictedValue(List list) { + public final Builder predictedValue(List list) { this.predictedValue = _listAddAll(this.predictedValue, list); return this; } @@ -332,20 +385,39 @@ public final Builder predictedValue(List list) { * task, the response is the predicted class. For named entity recognition (NER) * tasks, it contains the annotated text output. For fill mask tasks, it * contains the top prediction for replacing the mask token. For text embedding - * tasks, it contains the raw numerical text embedding values. + * tasks, it contains the raw numerical text embedding values. For regression + * models, its a numerical value For classification models, it may be an + * integer, double, boolean or string depending on prediction type *

* API name: {@code predicted_value} *

* Adds one or more values to predictedValue. */ - public final Builder predictedValue(String value, String... values) { + public final Builder predictedValue(FieldValue value, FieldValue... values) { this.predictedValue = _listAdd(this.predictedValue, value, values); return this; } + /** + * If the model is trained for a text classification or zero shot classification + * task, the response is the predicted class. For named entity recognition (NER) + * tasks, it contains the annotated text output. For fill mask tasks, it + * contains the top prediction for replacing the mask token. For text embedding + * tasks, it contains the raw numerical text embedding values. For regression + * models, its a numerical value For classification models, it may be an + * integer, double, boolean or string depending on prediction type + *

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

+ * Adds a value to predictedValue using a builder lambda. + */ + public final Builder predictedValue(Function> fn) { + return predictedValue(fn.apply(new FieldValue.Builder()).build()); + } + /** * For fill mask tasks, the response contains the input text sequence with the - * mask token replaced by the predicted value. + * mask token replaced by the predicted value. Additionally *

* API name: {@code predicted_value_sequence} */ @@ -355,7 +427,7 @@ public final Builder predictedValueSequence(@Nullable String value) { } /** - * Specifies a confidence score for the predicted value. + * Specifies a probability for the predicted value. *

* API name: {@code prediction_probability} */ @@ -365,8 +437,18 @@ public final Builder predictionProbability(@Nullable Double value) { } /** - * Required - For fill mask, text classification, and zero shot classification - * tasks, the response contains a list of top class entries. + * Specifies a confidence score for the predicted value. + *

+ * API name: {@code prediction_score} + */ + public final Builder predictionScore(@Nullable Double value) { + this.predictionScore = value; + return this; + } + + /** + * For fill mask, text classification, and zero shot classification tasks, the + * response contains a list of top class entries. *

* API name: {@code top_classes} *

@@ -378,8 +460,8 @@ public final Builder topClasses(List list) { } /** - * Required - For fill mask, text classification, and zero shot classification - * tasks, the response contains a list of top class entries. + * For fill mask, text classification, and zero shot classification tasks, the + * response contains a list of top class entries. *

* API name: {@code top_classes} *

@@ -391,8 +473,8 @@ public final Builder topClasses(TopClassEntry value, TopClassEntry... values) { } /** - * Required - For fill mask, text classification, and zero shot classification - * tasks, the response contains a list of top class entries. + * For fill mask, text classification, and zero shot classification tasks, the + * response contains a list of top class entries. *

* API name: {@code top_classes} *

@@ -412,44 +494,87 @@ public final Builder warning(@Nullable String value) { return this; } + /** + * The feature importance for the inference results. Relevant only for + * classification or regression models + *

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

+ * Adds all elements of list to featureImportance. + */ + public final Builder featureImportance(List list) { + this.featureImportance = _listAddAll(this.featureImportance, list); + return this; + } + + /** + * The feature importance for the inference results. Relevant only for + * classification or regression models + *

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

+ * Adds one or more values to featureImportance. + */ + public final Builder featureImportance(TrainedModelInferenceFeatureImportance value, + TrainedModelInferenceFeatureImportance... values) { + this.featureImportance = _listAdd(this.featureImportance, value, values); + return this; + } + + /** + * The feature importance for the inference results. Relevant only for + * classification or regression models + *

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

+ * Adds a value to featureImportance using a builder lambda. + */ + public final Builder featureImportance( + Function> fn) { + return featureImportance(fn.apply(new TrainedModelInferenceFeatureImportance.Builder()).build()); + } + @Override protected Builder self() { return this; } /** - * Builds a {@link InferTrainedModelDeploymentResponse}. + * Builds a {@link InferenceResponseResult}. * * @throws NullPointerException * if some of the required fields are null. */ - public InferTrainedModelDeploymentResponse build() { + public InferenceResponseResult build() { _checkSingleUse(); - return new InferTrainedModelDeploymentResponse(this); + return new InferenceResponseResult(this); } } // --------------------------------------------------------------------------------------------- /** - * Json deserializer for {@link InferTrainedModelDeploymentResponse} + * Json deserializer for {@link InferenceResponseResult} */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, - InferTrainedModelDeploymentResponse::setupInferTrainedModelDeploymentResponseDeserializer); + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, InferenceResponseResult::setupInferenceResponseResultDeserializer); - protected static void setupInferTrainedModelDeploymentResponseDeserializer( - ObjectDeserializer op) { + protected static void setupInferenceResponseResultDeserializer( + ObjectDeserializer op) { op.add(Builder::entities, JsonpDeserializer.arrayDeserializer(TrainedModelEntities._DESERIALIZER), "entities"); op.add(Builder::isTruncated, JsonpDeserializer.booleanDeserializer(), "is_truncated"); - op.add(Builder::predictedValue, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), + op.add(Builder::predictedValue, JsonpDeserializer.arrayDeserializer(FieldValue._DESERIALIZER), "predicted_value"); op.add(Builder::predictedValueSequence, JsonpDeserializer.stringDeserializer(), "predicted_value_sequence"); op.add(Builder::predictionProbability, JsonpDeserializer.doubleDeserializer(), "prediction_probability"); + op.add(Builder::predictionScore, JsonpDeserializer.doubleDeserializer(), "prediction_score"); op.add(Builder::topClasses, JsonpDeserializer.arrayDeserializer(TopClassEntry._DESERIALIZER), "top_classes"); op.add(Builder::warning, JsonpDeserializer.stringDeserializer(), "warning"); + op.add(Builder::featureImportance, + JsonpDeserializer.arrayDeserializer(TrainedModelInferenceFeatureImportance._DESERIALIZER), + "feature_importance"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/NerInferenceUpdateOptions.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/NerInferenceUpdateOptions.java index 1983d8909..c5314419c 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/NerInferenceUpdateOptions.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/NerInferenceUpdateOptions.java @@ -47,7 +47,7 @@ * specification */ @JsonpDeserializable -public class NerInferenceUpdateOptions implements NlpInferenceConfigUpdateVariant, JsonpSerializable { +public class NerInferenceUpdateOptions implements InferenceConfigUpdateVariant, JsonpSerializable { @Nullable private final NlpTokenizationUpdateOptions tokenization; @@ -68,11 +68,11 @@ public static NerInferenceUpdateOptions of(Function> fn) { - NlpInferenceConfigUpdate.Builder builder = new NlpInferenceConfigUpdate.Builder(); - builder.textClassification(fn.apply(new TextClassificationInferenceUpdateOptions.Builder()).build()); - return builder.build(); - } - - /** - * Creates a builder for the {@link ZeroShotClassificationInferenceUpdateOptions - * zero_shot_classification} {@code NlpInferenceConfigUpdate} variant. - */ - public static ZeroShotClassificationInferenceUpdateOptions.Builder zeroShotClassification() { - return new ZeroShotClassificationInferenceUpdateOptions.Builder(); - } - - /** - * Creates a NlpInferenceConfigUpdate of the - * {@link ZeroShotClassificationInferenceUpdateOptions zero_shot_classification} - * {@code NlpInferenceConfigUpdate} variant. - */ - public static NlpInferenceConfigUpdate zeroShotClassification( - Function> fn) { - NlpInferenceConfigUpdate.Builder builder = new NlpInferenceConfigUpdate.Builder(); - builder.zeroShotClassification(fn.apply(new ZeroShotClassificationInferenceUpdateOptions.Builder()).build()); - return builder.build(); - } - - /** - * Creates a builder for the {@link FillMaskInferenceUpdateOptions fill_mask} - * {@code NlpInferenceConfigUpdate} variant. - */ - public static FillMaskInferenceUpdateOptions.Builder fillMask() { - return new FillMaskInferenceUpdateOptions.Builder(); - } - - /** - * Creates a NlpInferenceConfigUpdate of the - * {@link FillMaskInferenceUpdateOptions fill_mask} - * {@code NlpInferenceConfigUpdate} variant. - */ - public static NlpInferenceConfigUpdate fillMask( - Function> fn) { - NlpInferenceConfigUpdate.Builder builder = new NlpInferenceConfigUpdate.Builder(); - builder.fillMask(fn.apply(new FillMaskInferenceUpdateOptions.Builder()).build()); - return builder.build(); - } - - /** - * Creates a builder for the {@link NerInferenceUpdateOptions ner} - * {@code NlpInferenceConfigUpdate} variant. - */ - public static NerInferenceUpdateOptions.Builder ner() { - return new NerInferenceUpdateOptions.Builder(); - } - - /** - * Creates a NlpInferenceConfigUpdate of the {@link NerInferenceUpdateOptions - * ner} {@code NlpInferenceConfigUpdate} variant. - */ - public static NlpInferenceConfigUpdate ner( - Function> fn) { - NlpInferenceConfigUpdate.Builder builder = new NlpInferenceConfigUpdate.Builder(); - builder.ner(fn.apply(new NerInferenceUpdateOptions.Builder()).build()); - return builder.build(); - } - - /** - * Creates a builder for the {@link PassThroughInferenceUpdateOptions - * pass_through} {@code NlpInferenceConfigUpdate} variant. - */ - public static PassThroughInferenceUpdateOptions.Builder passThrough() { - return new PassThroughInferenceUpdateOptions.Builder(); - } - - /** - * Creates a NlpInferenceConfigUpdate of the - * {@link PassThroughInferenceUpdateOptions pass_through} - * {@code NlpInferenceConfigUpdate} variant. - */ - public static NlpInferenceConfigUpdate passThrough( - Function> fn) { - NlpInferenceConfigUpdate.Builder builder = new NlpInferenceConfigUpdate.Builder(); - builder.passThrough(fn.apply(new PassThroughInferenceUpdateOptions.Builder()).build()); - return builder.build(); - } - - /** - * Creates a builder for the {@link TextEmbeddingInferenceUpdateOptions - * text_embedding} {@code NlpInferenceConfigUpdate} variant. - */ - public static TextEmbeddingInferenceUpdateOptions.Builder textEmbedding() { - return new TextEmbeddingInferenceUpdateOptions.Builder(); - } - - /** - * Creates a NlpInferenceConfigUpdate of the - * {@link TextEmbeddingInferenceUpdateOptions text_embedding} - * {@code NlpInferenceConfigUpdate} variant. - */ - public static NlpInferenceConfigUpdate textEmbedding( - Function> fn) { - NlpInferenceConfigUpdate.Builder builder = new NlpInferenceConfigUpdate.Builder(); - builder.textEmbedding(fn.apply(new TextEmbeddingInferenceUpdateOptions.Builder()).build()); - return builder.build(); - } - -} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/PassThroughInferenceUpdateOptions.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/PassThroughInferenceUpdateOptions.java index d1b0b1d97..e471c3c61 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/PassThroughInferenceUpdateOptions.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/PassThroughInferenceUpdateOptions.java @@ -47,7 +47,7 @@ * specification */ @JsonpDeserializable -public class PassThroughInferenceUpdateOptions implements NlpInferenceConfigUpdateVariant, JsonpSerializable { +public class PassThroughInferenceUpdateOptions implements InferenceConfigUpdateVariant, JsonpSerializable { @Nullable private final NlpTokenizationUpdateOptions tokenization; @@ -69,11 +69,11 @@ public static PassThroughInferenceUpdateOptions of( } /** - * NlpInferenceConfigUpdate variant kind. + * InferenceConfigUpdate variant kind. */ @Override - public NlpInferenceConfigUpdate.Kind _nlpInferenceConfigUpdateKind() { - return NlpInferenceConfigUpdate.Kind.PassThrough; + public InferenceConfigUpdate.Kind _inferenceConfigUpdateKind() { + return InferenceConfigUpdate.Kind.PassThrough; } /** diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/QuestionAnsweringInferenceOptions.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/QuestionAnsweringInferenceOptions.java new file mode 100644 index 000000000..c7a8847bc --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/QuestionAnsweringInferenceOptions.java @@ -0,0 +1,276 @@ +/* + * 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.ml; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpUtils; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.WithJsonObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.Integer; +import java.lang.String; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: ml._types.QuestionAnsweringInferenceOptions + +/** + * Question answering inference options + * + * @see API + * specification + */ +@JsonpDeserializable +public class QuestionAnsweringInferenceOptions implements InferenceConfigCreateVariant, JsonpSerializable { + @Nullable + private final Integer numTopClasses; + + @Nullable + private final TokenizationConfig tokenization; + + @Nullable + private final String resultsField; + + @Nullable + private final Integer maxAnswerLength; + + // --------------------------------------------------------------------------------------------- + + private QuestionAnsweringInferenceOptions(Builder builder) { + + this.numTopClasses = builder.numTopClasses; + this.tokenization = builder.tokenization; + this.resultsField = builder.resultsField; + this.maxAnswerLength = builder.maxAnswerLength; + + } + + public static QuestionAnsweringInferenceOptions of( + Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * InferenceConfigCreate variant kind. + */ + @Override + public InferenceConfigCreate.Kind _inferenceConfigCreateKind() { + return InferenceConfigCreate.Kind.QuestionAnswering; + } + + /** + * Specifies the number of top class predictions to return. Defaults to 0. + *

+ * API name: {@code num_top_classes} + */ + @Nullable + public final Integer numTopClasses() { + return this.numTopClasses; + } + + /** + * The tokenization options to update when inferring + *

+ * API name: {@code tokenization} + */ + @Nullable + public final TokenizationConfig tokenization() { + return this.tokenization; + } + + /** + * The field that is added to incoming documents to contain the inference + * prediction. Defaults to predicted_value. + *

+ * API name: {@code results_field} + */ + @Nullable + public final String resultsField() { + return this.resultsField; + } + + /** + * The maximum answer length to consider + *

+ * API name: {@code max_answer_length} + */ + @Nullable + public final Integer maxAnswerLength() { + return this.maxAnswerLength; + } + + /** + * 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.numTopClasses != null) { + generator.writeKey("num_top_classes"); + generator.write(this.numTopClasses); + + } + if (this.tokenization != null) { + generator.writeKey("tokenization"); + this.tokenization.serialize(generator, mapper); + + } + if (this.resultsField != null) { + generator.writeKey("results_field"); + generator.write(this.resultsField); + + } + if (this.maxAnswerLength != null) { + generator.writeKey("max_answer_length"); + generator.write(this.maxAnswerLength); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link QuestionAnsweringInferenceOptions}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + @Nullable + private Integer numTopClasses; + + @Nullable + private TokenizationConfig tokenization; + + @Nullable + private String resultsField; + + @Nullable + private Integer maxAnswerLength; + + /** + * Specifies the number of top class predictions to return. Defaults to 0. + *

+ * API name: {@code num_top_classes} + */ + public final Builder numTopClasses(@Nullable Integer value) { + this.numTopClasses = value; + return this; + } + + /** + * The tokenization options to update when inferring + *

+ * API name: {@code tokenization} + */ + public final Builder tokenization(@Nullable TokenizationConfig value) { + this.tokenization = value; + return this; + } + + /** + * The tokenization options to update when inferring + *

+ * API name: {@code tokenization} + */ + public final Builder tokenization(Function> fn) { + return this.tokenization(fn.apply(new TokenizationConfig.Builder()).build()); + } + + /** + * The field that is added to incoming documents to contain the inference + * prediction. Defaults to predicted_value. + *

+ * API name: {@code results_field} + */ + public final Builder resultsField(@Nullable String value) { + this.resultsField = value; + return this; + } + + /** + * The maximum answer length to consider + *

+ * API name: {@code max_answer_length} + */ + public final Builder maxAnswerLength(@Nullable Integer value) { + this.maxAnswerLength = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link QuestionAnsweringInferenceOptions}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public QuestionAnsweringInferenceOptions build() { + _checkSingleUse(); + + return new QuestionAnsweringInferenceOptions(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link QuestionAnsweringInferenceOptions} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, QuestionAnsweringInferenceOptions::setupQuestionAnsweringInferenceOptionsDeserializer); + + protected static void setupQuestionAnsweringInferenceOptionsDeserializer( + ObjectDeserializer op) { + + op.add(Builder::numTopClasses, JsonpDeserializer.integerDeserializer(), "num_top_classes"); + op.add(Builder::tokenization, TokenizationConfig._DESERIALIZER, "tokenization"); + op.add(Builder::resultsField, JsonpDeserializer.stringDeserializer(), "results_field"); + op.add(Builder::maxAnswerLength, JsonpDeserializer.integerDeserializer(), "max_answer_length"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/QuestionAnsweringInferenceUpdateOptions.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/QuestionAnsweringInferenceUpdateOptions.java new file mode 100644 index 000000000..89e85374e --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/QuestionAnsweringInferenceUpdateOptions.java @@ -0,0 +1,306 @@ +/* + * 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.ml; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpUtils; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.WithJsonObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.Integer; +import java.lang.String; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: ml._types.QuestionAnsweringInferenceUpdateOptions + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class QuestionAnsweringInferenceUpdateOptions implements InferenceConfigUpdateVariant, JsonpSerializable { + private final String question; + + @Nullable + private final Integer numTopClasses; + + @Nullable + private final NlpTokenizationUpdateOptions tokenization; + + @Nullable + private final String resultsField; + + @Nullable + private final Integer maxAnswerLength; + + // --------------------------------------------------------------------------------------------- + + private QuestionAnsweringInferenceUpdateOptions(Builder builder) { + + this.question = ApiTypeHelper.requireNonNull(builder.question, this, "question"); + this.numTopClasses = builder.numTopClasses; + this.tokenization = builder.tokenization; + this.resultsField = builder.resultsField; + this.maxAnswerLength = builder.maxAnswerLength; + + } + + public static QuestionAnsweringInferenceUpdateOptions of( + Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * InferenceConfigUpdate variant kind. + */ + @Override + public InferenceConfigUpdate.Kind _inferenceConfigUpdateKind() { + return InferenceConfigUpdate.Kind.QuestionAnswering; + } + + /** + * Required - The question to answer given the inference context + *

+ * API name: {@code question} + */ + public final String question() { + return this.question; + } + + /** + * Specifies the number of top class predictions to return. Defaults to 0. + *

+ * API name: {@code num_top_classes} + */ + @Nullable + public final Integer numTopClasses() { + return this.numTopClasses; + } + + /** + * The tokenization options to update when inferring + *

+ * API name: {@code tokenization} + */ + @Nullable + public final NlpTokenizationUpdateOptions tokenization() { + return this.tokenization; + } + + /** + * The field that is added to incoming documents to contain the inference + * prediction. Defaults to predicted_value. + *

+ * API name: {@code results_field} + */ + @Nullable + public final String resultsField() { + return this.resultsField; + } + + /** + * The maximum answer length to consider for extraction + *

+ * API name: {@code max_answer_length} + */ + @Nullable + public final Integer maxAnswerLength() { + return this.maxAnswerLength; + } + + /** + * 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("question"); + generator.write(this.question); + + if (this.numTopClasses != null) { + generator.writeKey("num_top_classes"); + generator.write(this.numTopClasses); + + } + if (this.tokenization != null) { + generator.writeKey("tokenization"); + this.tokenization.serialize(generator, mapper); + + } + if (this.resultsField != null) { + generator.writeKey("results_field"); + generator.write(this.resultsField); + + } + if (this.maxAnswerLength != null) { + generator.writeKey("max_answer_length"); + generator.write(this.maxAnswerLength); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link QuestionAnsweringInferenceUpdateOptions}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private String question; + + @Nullable + private Integer numTopClasses; + + @Nullable + private NlpTokenizationUpdateOptions tokenization; + + @Nullable + private String resultsField; + + @Nullable + private Integer maxAnswerLength; + + /** + * Required - The question to answer given the inference context + *

+ * API name: {@code question} + */ + public final Builder question(String value) { + this.question = value; + return this; + } + + /** + * Specifies the number of top class predictions to return. Defaults to 0. + *

+ * API name: {@code num_top_classes} + */ + public final Builder numTopClasses(@Nullable Integer value) { + this.numTopClasses = value; + return this; + } + + /** + * The tokenization options to update when inferring + *

+ * API name: {@code tokenization} + */ + public final Builder tokenization(@Nullable NlpTokenizationUpdateOptions value) { + this.tokenization = value; + return this; + } + + /** + * The tokenization options to update when inferring + *

+ * API name: {@code tokenization} + */ + public final Builder tokenization( + Function> fn) { + return this.tokenization(fn.apply(new NlpTokenizationUpdateOptions.Builder()).build()); + } + + /** + * The field that is added to incoming documents to contain the inference + * prediction. Defaults to predicted_value. + *

+ * API name: {@code results_field} + */ + public final Builder resultsField(@Nullable String value) { + this.resultsField = value; + return this; + } + + /** + * The maximum answer length to consider for extraction + *

+ * API name: {@code max_answer_length} + */ + public final Builder maxAnswerLength(@Nullable Integer value) { + this.maxAnswerLength = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link QuestionAnsweringInferenceUpdateOptions}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public QuestionAnsweringInferenceUpdateOptions build() { + _checkSingleUse(); + + return new QuestionAnsweringInferenceUpdateOptions(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link QuestionAnsweringInferenceUpdateOptions} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, + QuestionAnsweringInferenceUpdateOptions::setupQuestionAnsweringInferenceUpdateOptionsDeserializer); + + protected static void setupQuestionAnsweringInferenceUpdateOptionsDeserializer( + ObjectDeserializer op) { + + op.add(Builder::question, JsonpDeserializer.stringDeserializer(), "question"); + op.add(Builder::numTopClasses, JsonpDeserializer.integerDeserializer(), "num_top_classes"); + op.add(Builder::tokenization, NlpTokenizationUpdateOptions._DESERIALIZER, "tokenization"); + op.add(Builder::resultsField, JsonpDeserializer.stringDeserializer(), "results_field"); + op.add(Builder::maxAnswerLength, JsonpDeserializer.integerDeserializer(), "max_answer_length"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/RegressionInferenceOptions.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/RegressionInferenceOptions.java index 3966e152c..565e3b221 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/RegressionInferenceOptions.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/RegressionInferenceOptions.java @@ -52,6 +52,7 @@ @JsonpDeserializable public class RegressionInferenceOptions implements + InferenceConfigUpdateVariant, InferenceConfigCreateVariant, InferenceConfigVariant, JsonpSerializable { @@ -74,6 +75,14 @@ public static RegressionInferenceOptions of(Function - * API name: {@code inference_threads} - */ - @Nullable - public final Integer inferenceThreads() { - return this.inferenceThreads; - } - /** * Required - The unique identifier of the trained model. Currently, only * PyTorch models are supported. @@ -114,14 +102,18 @@ public final String modelId() { } /** - * Specifies the number of threads that are used when sending inference requests - * to the model. If you increase this value, throughput generally increases. + * The number of model allocations on each node where the model is deployed. All + * allocations on a node share the same copy of the model in memory but use a + * separate set of threads to evaluate the model. Increasing this value + * generally increases the throughput. If this setting is greater than the + * number of hardware threads it will automatically be changed to a value less + * than the number of hardware threads. *

- * API name: {@code model_threads} + * API name: {@code number_of_allocations} */ @Nullable - public final Integer modelThreads() { - return this.modelThreads; + public final Integer numberOfAllocations() { + return this.numberOfAllocations; } /** @@ -136,6 +128,21 @@ public final Integer queueCapacity() { return this.queueCapacity; } + /** + * Sets the number of threads used by each model allocation during inference. + * This generally increases the inference speed. The inference process is a + * compute-bound process; any number greater than the number of available + * hardware threads on the machine does not increase the inference speed. If + * this setting is greater than the number of hardware threads it will + * automatically be changed to a value less than the number of hardware threads. + *

+ * API name: {@code threads_per_allocation} + */ + @Nullable + public final Integer threadsPerAllocation() { + return this.threadsPerAllocation; + } + /** * Specifies the amount of time to wait for the model to deploy. *

@@ -163,35 +170,23 @@ public final DeploymentAllocationState waitFor() { */ public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Nullable - private Integer inferenceThreads; - private String modelId; @Nullable - private Integer modelThreads; + private Integer numberOfAllocations; @Nullable private Integer queueCapacity; + @Nullable + private Integer threadsPerAllocation; + @Nullable private Time timeout; @Nullable private DeploymentAllocationState waitFor; - /** - * Specifies the number of threads that are used by the inference process. If - * you increase this value, inference speed generally increases. However, the - * actual number of threads is limited by the number of available CPU cores. - *

- * API name: {@code inference_threads} - */ - public final Builder inferenceThreads(@Nullable Integer value) { - this.inferenceThreads = value; - return this; - } - /** * Required - The unique identifier of the trained model. Currently, only * PyTorch models are supported. @@ -204,13 +199,17 @@ public final Builder modelId(String value) { } /** - * Specifies the number of threads that are used when sending inference requests - * to the model. If you increase this value, throughput generally increases. + * The number of model allocations on each node where the model is deployed. All + * allocations on a node share the same copy of the model in memory but use a + * separate set of threads to evaluate the model. Increasing this value + * generally increases the throughput. If this setting is greater than the + * number of hardware threads it will automatically be changed to a value less + * than the number of hardware threads. *

- * API name: {@code model_threads} + * API name: {@code number_of_allocations} */ - public final Builder modelThreads(@Nullable Integer value) { - this.modelThreads = value; + public final Builder numberOfAllocations(@Nullable Integer value) { + this.numberOfAllocations = value; return this; } @@ -226,6 +225,21 @@ public final Builder queueCapacity(@Nullable Integer value) { return this; } + /** + * Sets the number of threads used by each model allocation during inference. + * This generally increases the inference speed. The inference process is a + * compute-bound process; any number greater than the number of available + * hardware threads on the machine does not increase the inference speed. If + * this setting is greater than the number of hardware threads it will + * automatically be changed to a value less than the number of hardware threads. + *

+ * API name: {@code threads_per_allocation} + */ + public final Builder threadsPerAllocation(@Nullable Integer value) { + this.threadsPerAllocation = value; + return this; + } + /** * Specifies the amount of time to wait for the model to deploy. *

@@ -307,14 +321,14 @@ public StartTrainedModelDeploymentRequest build() { // Request parameters request -> { Map params = new HashMap<>(); - if (request.inferenceThreads != null) { - params.put("inference_threads", String.valueOf(request.inferenceThreads)); + if (request.threadsPerAllocation != null) { + params.put("threads_per_allocation", String.valueOf(request.threadsPerAllocation)); } if (request.waitFor != null) { params.put("wait_for", request.waitFor.jsonValue()); } - if (request.modelThreads != null) { - params.put("model_threads", String.valueOf(request.modelThreads)); + if (request.numberOfAllocations != null) { + params.put("number_of_allocations", String.valueOf(request.numberOfAllocations)); } if (request.timeout != null) { params.put("timeout", request.timeout._toJsonString()); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TextClassificationInferenceUpdateOptions.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TextClassificationInferenceUpdateOptions.java index 5e80d98fa..1f606a9e0 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TextClassificationInferenceUpdateOptions.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TextClassificationInferenceUpdateOptions.java @@ -50,7 +50,7 @@ * specification */ @JsonpDeserializable -public class TextClassificationInferenceUpdateOptions implements NlpInferenceConfigUpdateVariant, JsonpSerializable { +public class TextClassificationInferenceUpdateOptions implements InferenceConfigUpdateVariant, JsonpSerializable { @Nullable private final Integer numTopClasses; @@ -79,11 +79,11 @@ public static TextClassificationInferenceUpdateOptions of( } /** - * NlpInferenceConfigUpdate variant kind. + * InferenceConfigUpdate variant kind. */ @Override - public NlpInferenceConfigUpdate.Kind _nlpInferenceConfigUpdateKind() { - return NlpInferenceConfigUpdate.Kind.TextClassification; + public InferenceConfigUpdate.Kind _inferenceConfigUpdateKind() { + return InferenceConfigUpdate.Kind.TextClassification; } /** diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TextEmbeddingInferenceUpdateOptions.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TextEmbeddingInferenceUpdateOptions.java index 2c27f17ae..8c50fbedd 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TextEmbeddingInferenceUpdateOptions.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TextEmbeddingInferenceUpdateOptions.java @@ -47,7 +47,7 @@ * specification */ @JsonpDeserializable -public class TextEmbeddingInferenceUpdateOptions implements NlpInferenceConfigUpdateVariant, JsonpSerializable { +public class TextEmbeddingInferenceUpdateOptions implements InferenceConfigUpdateVariant, JsonpSerializable { @Nullable private final NlpTokenizationUpdateOptions tokenization; @@ -69,11 +69,11 @@ public static TextEmbeddingInferenceUpdateOptions of( } /** - * NlpInferenceConfigUpdate variant kind. + * InferenceConfigUpdate variant kind. */ @Override - public NlpInferenceConfigUpdate.Kind _nlpInferenceConfigUpdateKind() { - return NlpInferenceConfigUpdate.Kind.TextEmbedding; + public InferenceConfigUpdate.Kind _inferenceConfigUpdateKind() { + return InferenceConfigUpdate.Kind.TextEmbedding; } /** diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TrainedModelDeploymentNodesStats.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TrainedModelDeploymentNodesStats.java index 8433ab40b..c184afdb0 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TrainedModelDeploymentNodesStats.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TrainedModelDeploymentNodesStats.java @@ -57,14 +57,12 @@ public class TrainedModelDeploymentNodesStats implements JsonpSerializable { private final int inferenceCount; - private final int inferenceThreads; - private final long lastAccess; - private final int modelThreads; - private final DiscoveryNode node; + private final int numberOfAllocations; + private final int numberOfPendingRequests; private final int rejectionExecutionCount; @@ -73,6 +71,8 @@ public class TrainedModelDeploymentNodesStats implements JsonpSerializable { private final long startTime; + private final int threadsPerAllocation; + private final int timeoutCount; // --------------------------------------------------------------------------------------------- @@ -83,16 +83,18 @@ private TrainedModelDeploymentNodesStats(Builder builder) { "averageInferenceTimeMs"); this.errorCount = ApiTypeHelper.requireNonNull(builder.errorCount, this, "errorCount"); this.inferenceCount = ApiTypeHelper.requireNonNull(builder.inferenceCount, this, "inferenceCount"); - this.inferenceThreads = ApiTypeHelper.requireNonNull(builder.inferenceThreads, this, "inferenceThreads"); this.lastAccess = ApiTypeHelper.requireNonNull(builder.lastAccess, this, "lastAccess"); - this.modelThreads = ApiTypeHelper.requireNonNull(builder.modelThreads, this, "modelThreads"); this.node = ApiTypeHelper.requireNonNull(builder.node, this, "node"); + this.numberOfAllocations = ApiTypeHelper.requireNonNull(builder.numberOfAllocations, this, + "numberOfAllocations"); this.numberOfPendingRequests = ApiTypeHelper.requireNonNull(builder.numberOfPendingRequests, this, "numberOfPendingRequests"); this.rejectionExecutionCount = ApiTypeHelper.requireNonNull(builder.rejectionExecutionCount, this, "rejectionExecutionCount"); this.routingState = ApiTypeHelper.requireNonNull(builder.routingState, this, "routingState"); this.startTime = ApiTypeHelper.requireNonNull(builder.startTime, this, "startTime"); + this.threadsPerAllocation = ApiTypeHelper.requireNonNull(builder.threadsPerAllocation, this, + "threadsPerAllocation"); this.timeoutCount = ApiTypeHelper.requireNonNull(builder.timeoutCount, this, "timeoutCount"); } @@ -130,18 +132,6 @@ public final int inferenceCount() { return this.inferenceCount; } - /** - * Required - The number of threads used by the inference process. This value is - * limited by the number of hardware threads on the node; it might therefore - * differ from the inference_threads value in the start trained - * model deployment API. - *

- * API name: {@code inference_threads} - */ - public final int inferenceThreads() { - return this.inferenceThreads; - } - /** * Required - The epoch time stamp of the last inference call for the model on * this node. @@ -153,24 +143,21 @@ public final long lastAccess() { } /** - * Required - The number of threads used when sending inference requests to the - * model. This value is limited by the number of hardware threads on the node; - * it might therefore differ from the model_threads value in the - * start trained model deployment API. + * Required - Information pertaining to the node. *

- * API name: {@code model_threads} + * API name: {@code node} */ - public final int modelThreads() { - return this.modelThreads; + public final DiscoveryNode node() { + return this.node; } /** - * Required - Information pertaining to the node. + * Required - The number of allocations assigned to this node. *

- * API name: {@code node} + * API name: {@code number_of_allocations} */ - public final DiscoveryNode node() { - return this.node; + public final int numberOfAllocations() { + return this.numberOfAllocations; } /** @@ -211,6 +198,15 @@ public final long startTime() { return this.startTime; } + /** + * Required - The number of threads used by each allocation during inference. + *

+ * API name: {@code threads_per_allocation} + */ + public final int threadsPerAllocation() { + return this.threadsPerAllocation; + } + /** * Required - The number of inference requests that timed out before being * processed. @@ -241,18 +237,15 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("inference_count"); generator.write(this.inferenceCount); - generator.writeKey("inference_threads"); - generator.write(this.inferenceThreads); - generator.writeKey("last_access"); generator.write(this.lastAccess); - generator.writeKey("model_threads"); - generator.write(this.modelThreads); - generator.writeKey("node"); this.node.serialize(generator, mapper); + generator.writeKey("number_of_allocations"); + generator.write(this.numberOfAllocations); + generator.writeKey("number_of_pending_requests"); generator.write(this.numberOfPendingRequests); @@ -265,6 +258,9 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("start_time"); generator.write(this.startTime); + generator.writeKey("threads_per_allocation"); + generator.write(this.threadsPerAllocation); + generator.writeKey("timeout_count"); generator.write(this.timeoutCount); @@ -290,14 +286,12 @@ public static class Builder extends WithJsonObjectBuilderBase private Integer inferenceCount; - private Integer inferenceThreads; - private Long lastAccess; - private Integer modelThreads; - private DiscoveryNode node; + private Integer numberOfAllocations; + private Integer numberOfPendingRequests; private Integer rejectionExecutionCount; @@ -306,6 +300,8 @@ public static class Builder extends WithJsonObjectBuilderBase private Long startTime; + private Integer threadsPerAllocation; + private Integer timeoutCount; /** @@ -339,19 +335,6 @@ public final Builder inferenceCount(int value) { return this; } - /** - * Required - The number of threads used by the inference process. This value is - * limited by the number of hardware threads on the node; it might therefore - * differ from the inference_threads value in the start trained - * model deployment API. - *

- * API name: {@code inference_threads} - */ - public final Builder inferenceThreads(int value) { - this.inferenceThreads = value; - return this; - } - /** * Required - The epoch time stamp of the last inference call for the model on * this node. @@ -363,19 +346,6 @@ public final Builder lastAccess(long value) { return this; } - /** - * Required - The number of threads used when sending inference requests to the - * model. This value is limited by the number of hardware threads on the node; - * it might therefore differ from the model_threads value in the - * start trained model deployment API. - *

- * API name: {@code model_threads} - */ - public final Builder modelThreads(int value) { - this.modelThreads = value; - return this; - } - /** * Required - Information pertaining to the node. *

@@ -395,6 +365,16 @@ public final Builder node(Function + * API name: {@code number_of_allocations} + */ + public final Builder numberOfAllocations(int value) { + this.numberOfAllocations = value; + return this; + } + /** * Required - The number of inference requests queued to be processed. *

@@ -448,6 +428,16 @@ public final Builder startTime(long value) { return this; } + /** + * Required - The number of threads used by each allocation during inference. + *

+ * API name: {@code threads_per_allocation} + */ + public final Builder threadsPerAllocation(int value) { + this.threadsPerAllocation = value; + return this; + } + /** * Required - The number of inference requests that timed out before being * processed. @@ -491,14 +481,14 @@ protected static void setupTrainedModelDeploymentNodesStatsDeserializer( op.add(Builder::averageInferenceTimeMs, JsonpDeserializer.doubleDeserializer(), "average_inference_time_ms"); op.add(Builder::errorCount, JsonpDeserializer.integerDeserializer(), "error_count"); op.add(Builder::inferenceCount, JsonpDeserializer.integerDeserializer(), "inference_count"); - op.add(Builder::inferenceThreads, JsonpDeserializer.integerDeserializer(), "inference_threads"); op.add(Builder::lastAccess, JsonpDeserializer.longDeserializer(), "last_access"); - op.add(Builder::modelThreads, JsonpDeserializer.integerDeserializer(), "model_threads"); op.add(Builder::node, DiscoveryNode._DESERIALIZER, "node"); + op.add(Builder::numberOfAllocations, JsonpDeserializer.integerDeserializer(), "number_of_allocations"); op.add(Builder::numberOfPendingRequests, JsonpDeserializer.integerDeserializer(), "number_of_pending_requests"); op.add(Builder::rejectionExecutionCount, JsonpDeserializer.integerDeserializer(), "rejection_execution_count"); op.add(Builder::routingState, TrainedModelAllocationRoutingTable._DESERIALIZER, "routing_state"); op.add(Builder::startTime, JsonpDeserializer.longDeserializer(), "start_time"); + op.add(Builder::threadsPerAllocation, JsonpDeserializer.integerDeserializer(), "threads_per_allocation"); op.add(Builder::timeoutCount, JsonpDeserializer.integerDeserializer(), "timeout_count"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TrainedModelDeploymentStats.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TrainedModelDeploymentStats.java index fc0a02b0a..dfe551b64 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TrainedModelDeploymentStats.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TrainedModelDeploymentStats.java @@ -57,14 +57,12 @@ public class TrainedModelDeploymentStats implements JsonpSerializable { private final int inferenceCount; - private final int inferenceThreads; - private final String modelId; - private final int modelThreads; - private final TrainedModelDeploymentNodesStats nodes; + private final int numberOfAllocations; + private final int queueCapacity; private final int rejectedExecutionCount; @@ -75,6 +73,8 @@ public class TrainedModelDeploymentStats implements JsonpSerializable { private final DeploymentState state; + private final int threadsPerAllocation; + private final int timeoutCount; // --------------------------------------------------------------------------------------------- @@ -84,16 +84,18 @@ private TrainedModelDeploymentStats(Builder builder) { this.allocationStatus = ApiTypeHelper.requireNonNull(builder.allocationStatus, this, "allocationStatus"); this.errorCount = ApiTypeHelper.requireNonNull(builder.errorCount, this, "errorCount"); this.inferenceCount = ApiTypeHelper.requireNonNull(builder.inferenceCount, this, "inferenceCount"); - this.inferenceThreads = ApiTypeHelper.requireNonNull(builder.inferenceThreads, this, "inferenceThreads"); this.modelId = ApiTypeHelper.requireNonNull(builder.modelId, this, "modelId"); - this.modelThreads = ApiTypeHelper.requireNonNull(builder.modelThreads, this, "modelThreads"); this.nodes = ApiTypeHelper.requireNonNull(builder.nodes, this, "nodes"); + this.numberOfAllocations = ApiTypeHelper.requireNonNull(builder.numberOfAllocations, this, + "numberOfAllocations"); this.queueCapacity = ApiTypeHelper.requireNonNull(builder.queueCapacity, this, "queueCapacity"); this.rejectedExecutionCount = ApiTypeHelper.requireNonNull(builder.rejectedExecutionCount, this, "rejectedExecutionCount"); this.reason = ApiTypeHelper.requireNonNull(builder.reason, this, "reason"); this.startTime = ApiTypeHelper.requireNonNull(builder.startTime, this, "startTime"); this.state = ApiTypeHelper.requireNonNull(builder.state, this, "state"); + this.threadsPerAllocation = ApiTypeHelper.requireNonNull(builder.threadsPerAllocation, this, + "threadsPerAllocation"); this.timeoutCount = ApiTypeHelper.requireNonNull(builder.timeoutCount, this, "timeoutCount"); } @@ -131,15 +133,6 @@ public final int inferenceCount() { return this.inferenceCount; } - /** - * Required - The number of threads used by the inference process. - *

- * API name: {@code inference_threads} - */ - public final int inferenceThreads() { - return this.inferenceThreads; - } - /** * Required - The unique identifier for the trained model. *

@@ -149,16 +142,6 @@ public final String modelId() { return this.modelId; } - /** - * Required - The number of threads used when sending inference requests to the - * model. - *

- * API name: {@code model_threads} - */ - public final int modelThreads() { - return this.modelThreads; - } - /** * Required - The deployent stats for each node that currently has the model * allocated. @@ -169,6 +152,15 @@ public final TrainedModelDeploymentNodesStats nodes() { return this.nodes; } + /** + * Required - The number of allocations requested. + *

+ * API name: {@code number_of_allocations} + */ + public final int numberOfAllocations() { + return this.numberOfAllocations; + } + /** * Required - The number of inference requests that can be queued before new * requests are rejected. @@ -220,6 +212,15 @@ public final DeploymentState state() { return this.state; } + /** + * Required - The number of threads used be each allocation during inference. + *

+ * API name: {@code threads_per_allocation} + */ + public final int threadsPerAllocation() { + return this.threadsPerAllocation; + } + /** * Required - The sum of timeout_count for all nodes in the * deployment. @@ -250,18 +251,15 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("inference_count"); generator.write(this.inferenceCount); - generator.writeKey("inference_threads"); - generator.write(this.inferenceThreads); - generator.writeKey("model_id"); generator.write(this.modelId); - generator.writeKey("model_threads"); - generator.write(this.modelThreads); - generator.writeKey("nodes"); this.nodes.serialize(generator, mapper); + generator.writeKey("number_of_allocations"); + generator.write(this.numberOfAllocations); + generator.writeKey("queue_capacity"); generator.write(this.queueCapacity); @@ -276,6 +274,9 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("state"); this.state.serialize(generator, mapper); + generator.writeKey("threads_per_allocation"); + generator.write(this.threadsPerAllocation); + generator.writeKey("timeout_count"); generator.write(this.timeoutCount); @@ -301,14 +302,12 @@ public static class Builder extends WithJsonObjectBuilderBase private Integer inferenceCount; - private Integer inferenceThreads; - private String modelId; - private Integer modelThreads; - private TrainedModelDeploymentNodesStats nodes; + private Integer numberOfAllocations; + private Integer queueCapacity; private Integer rejectedExecutionCount; @@ -319,6 +318,8 @@ public static class Builder extends WithJsonObjectBuilderBase private DeploymentState state; + private Integer threadsPerAllocation; + private Integer timeoutCount; /** @@ -363,16 +364,6 @@ public final Builder inferenceCount(int value) { return this; } - /** - * Required - The number of threads used by the inference process. - *

- * API name: {@code inference_threads} - */ - public final Builder inferenceThreads(int value) { - this.inferenceThreads = value; - return this; - } - /** * Required - The unique identifier for the trained model. *

@@ -383,17 +374,6 @@ public final Builder modelId(String value) { return this; } - /** - * Required - The number of threads used when sending inference requests to the - * model. - *

- * API name: {@code model_threads} - */ - public final Builder modelThreads(int value) { - this.modelThreads = value; - return this; - } - /** * Required - The deployent stats for each node that currently has the model * allocated. @@ -416,6 +396,16 @@ public final Builder nodes( return this.nodes(fn.apply(new TrainedModelDeploymentNodesStats.Builder()).build()); } + /** + * Required - The number of allocations requested. + *

+ * API name: {@code number_of_allocations} + */ + public final Builder numberOfAllocations(int value) { + this.numberOfAllocations = value; + return this; + } + /** * Required - The number of inference requests that can be queued before new * requests are rejected. @@ -472,6 +462,16 @@ public final Builder state(DeploymentState value) { return this; } + /** + * Required - The number of threads used be each allocation during inference. + *

+ * API name: {@code threads_per_allocation} + */ + public final Builder threadsPerAllocation(int value) { + this.threadsPerAllocation = value; + return this; + } + /** * Required - The sum of timeout_count for all nodes in the * deployment. @@ -515,15 +515,15 @@ protected static void setupTrainedModelDeploymentStatsDeserializer( op.add(Builder::allocationStatus, TrainedModelDeploymentAllocationStatus._DESERIALIZER, "allocation_status"); op.add(Builder::errorCount, JsonpDeserializer.integerDeserializer(), "error_count"); op.add(Builder::inferenceCount, JsonpDeserializer.integerDeserializer(), "inference_count"); - op.add(Builder::inferenceThreads, JsonpDeserializer.integerDeserializer(), "inference_threads"); op.add(Builder::modelId, JsonpDeserializer.stringDeserializer(), "model_id"); - op.add(Builder::modelThreads, JsonpDeserializer.integerDeserializer(), "model_threads"); op.add(Builder::nodes, TrainedModelDeploymentNodesStats._DESERIALIZER, "nodes"); + op.add(Builder::numberOfAllocations, JsonpDeserializer.integerDeserializer(), "number_of_allocations"); op.add(Builder::queueCapacity, JsonpDeserializer.integerDeserializer(), "queue_capacity"); op.add(Builder::rejectedExecutionCount, JsonpDeserializer.integerDeserializer(), "rejected_execution_count"); op.add(Builder::reason, JsonpDeserializer.stringDeserializer(), "reason"); op.add(Builder::startTime, JsonpDeserializer.longDeserializer(), "start_time"); op.add(Builder::state, DeploymentState._DESERIALIZER, "state"); + op.add(Builder::threadsPerAllocation, JsonpDeserializer.integerDeserializer(), "threads_per_allocation"); op.add(Builder::timeoutCount, JsonpDeserializer.integerDeserializer(), "timeout_count"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TrainedModelInferenceClassImportance.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TrainedModelInferenceClassImportance.java new file mode 100644 index 000000000..fcc2af780 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TrainedModelInferenceClassImportance.java @@ -0,0 +1,173 @@ +/* + * 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.ml; + +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.Double; +import java.lang.String; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: ml._types.TrainedModelInferenceClassImportance + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class TrainedModelInferenceClassImportance implements JsonpSerializable { + private final String className; + + private final double importance; + + // --------------------------------------------------------------------------------------------- + + private TrainedModelInferenceClassImportance(Builder builder) { + + this.className = ApiTypeHelper.requireNonNull(builder.className, this, "className"); + this.importance = ApiTypeHelper.requireNonNull(builder.importance, this, "importance"); + + } + + public static TrainedModelInferenceClassImportance of( + Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code class_name} + */ + public final String className() { + return this.className; + } + + /** + * Required - API name: {@code importance} + */ + public final double importance() { + return this.importance; + } + + /** + * 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("class_name"); + generator.write(this.className); + + generator.writeKey("importance"); + generator.write(this.importance); + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link TrainedModelInferenceClassImportance}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private String className; + + private Double importance; + + /** + * Required - API name: {@code class_name} + */ + public final Builder className(String value) { + this.className = value; + return this; + } + + /** + * Required - API name: {@code importance} + */ + public final Builder importance(double value) { + this.importance = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link TrainedModelInferenceClassImportance}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public TrainedModelInferenceClassImportance build() { + _checkSingleUse(); + + return new TrainedModelInferenceClassImportance(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link TrainedModelInferenceClassImportance} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, + TrainedModelInferenceClassImportance::setupTrainedModelInferenceClassImportanceDeserializer); + + protected static void setupTrainedModelInferenceClassImportanceDeserializer( + ObjectDeserializer op) { + + op.add(Builder::className, JsonpDeserializer.stringDeserializer(), "class_name"); + op.add(Builder::importance, JsonpDeserializer.doubleDeserializer(), "importance"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TrainedModelInferenceFeatureImportance.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TrainedModelInferenceFeatureImportance.java new file mode 100644 index 000000000..af1ee9810 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TrainedModelInferenceFeatureImportance.java @@ -0,0 +1,236 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.ml; + +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.Double; +import java.lang.String; +import java.util.List; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: ml._types.TrainedModelInferenceFeatureImportance + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class TrainedModelInferenceFeatureImportance implements JsonpSerializable { + private final String featureName; + + @Nullable + private final Double importance; + + private final List classes; + + // --------------------------------------------------------------------------------------------- + + private TrainedModelInferenceFeatureImportance(Builder builder) { + + this.featureName = ApiTypeHelper.requireNonNull(builder.featureName, this, "featureName"); + this.importance = builder.importance; + this.classes = ApiTypeHelper.unmodifiable(builder.classes); + + } + + public static TrainedModelInferenceFeatureImportance of( + Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code feature_name} + */ + public final String featureName() { + return this.featureName; + } + + /** + * API name: {@code importance} + */ + @Nullable + public final Double importance() { + return this.importance; + } + + /** + * API name: {@code classes} + */ + public final List classes() { + return this.classes; + } + + /** + * 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("feature_name"); + generator.write(this.featureName); + + if (this.importance != null) { + generator.writeKey("importance"); + generator.write(this.importance); + + } + if (ApiTypeHelper.isDefined(this.classes)) { + generator.writeKey("classes"); + generator.writeStartArray(); + for (TrainedModelInferenceClassImportance item0 : this.classes) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link TrainedModelInferenceFeatureImportance}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private String featureName; + + @Nullable + private Double importance; + + @Nullable + private List classes; + + /** + * Required - API name: {@code feature_name} + */ + public final Builder featureName(String value) { + this.featureName = value; + return this; + } + + /** + * API name: {@code importance} + */ + public final Builder importance(@Nullable Double value) { + this.importance = value; + return this; + } + + /** + * API name: {@code classes} + *

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

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

+ * Adds a value to classes using a builder lambda. + */ + public final Builder classes( + Function> fn) { + return classes(fn.apply(new TrainedModelInferenceClassImportance.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link TrainedModelInferenceFeatureImportance}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public TrainedModelInferenceFeatureImportance build() { + _checkSingleUse(); + + return new TrainedModelInferenceFeatureImportance(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link TrainedModelInferenceFeatureImportance} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, + TrainedModelInferenceFeatureImportance::setupTrainedModelInferenceFeatureImportanceDeserializer); + + protected static void setupTrainedModelInferenceFeatureImportanceDeserializer( + ObjectDeserializer op) { + + op.add(Builder::featureName, JsonpDeserializer.stringDeserializer(), "feature_name"); + op.add(Builder::importance, JsonpDeserializer.doubleDeserializer(), "importance"); + op.add(Builder::classes, + JsonpDeserializer.arrayDeserializer(TrainedModelInferenceClassImportance._DESERIALIZER), "classes"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ZeroShotClassificationInferenceUpdateOptions.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ZeroShotClassificationInferenceUpdateOptions.java index 850ce973a..265297ef2 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ZeroShotClassificationInferenceUpdateOptions.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ZeroShotClassificationInferenceUpdateOptions.java @@ -50,10 +50,7 @@ * specification */ @JsonpDeserializable -public class ZeroShotClassificationInferenceUpdateOptions - implements - NlpInferenceConfigUpdateVariant, - JsonpSerializable { +public class ZeroShotClassificationInferenceUpdateOptions implements InferenceConfigUpdateVariant, JsonpSerializable { @Nullable private final NlpTokenizationUpdateOptions tokenization; @@ -82,11 +79,11 @@ public static ZeroShotClassificationInferenceUpdateOptions of( } /** - * NlpInferenceConfigUpdate variant kind. + * InferenceConfigUpdate variant kind. */ @Override - public NlpInferenceConfigUpdate.Kind _nlpInferenceConfigUpdateKind() { - return NlpInferenceConfigUpdate.Kind.ZeroShotClassification; + public InferenceConfigUpdate.Kind _inferenceConfigUpdateKind() { + return InferenceConfigUpdate.Kind.ZeroShotClassification; } /** 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); }