diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/PhoneticTokenFilter.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/PhoneticTokenFilter.java index 508311e3c..019fc839c 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/PhoneticTokenFilter.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/PhoneticTokenFilter.java @@ -66,11 +66,13 @@ public class PhoneticTokenFilter extends TokenFilterBase implements TokenFilterD @Nullable private final Integer maxCodeLen; + @Nullable private final PhoneticNameType nameType; @Nullable private final Boolean replace; + @Nullable private final PhoneticRuleType ruleType; // --------------------------------------------------------------------------------------------- @@ -79,11 +81,11 @@ private PhoneticTokenFilter(Builder builder) { super(builder); this.encoder = ApiTypeHelper.requireNonNull(builder.encoder, this, "encoder"); - this.languageset = ApiTypeHelper.unmodifiableRequired(builder.languageset, this, "languageset"); + this.languageset = ApiTypeHelper.unmodifiable(builder.languageset); this.maxCodeLen = builder.maxCodeLen; - this.nameType = ApiTypeHelper.requireNonNull(builder.nameType, this, "nameType"); + this.nameType = builder.nameType; this.replace = builder.replace; - this.ruleType = ApiTypeHelper.requireNonNull(builder.ruleType, this, "ruleType"); + this.ruleType = builder.ruleType; } @@ -107,7 +109,7 @@ public final PhoneticEncoder encoder() { } /** - * Required - API name: {@code languageset} + * API name: {@code languageset} */ public final List languageset() { return this.languageset; @@ -122,8 +124,9 @@ public final Integer maxCodeLen() { } /** - * Required - API name: {@code name_type} + * API name: {@code name_type} */ + @Nullable public final PhoneticNameType nameType() { return this.nameType; } @@ -137,8 +140,9 @@ public final Boolean replace() { } /** - * Required - API name: {@code rule_type} + * API name: {@code rule_type} */ + @Nullable public final PhoneticRuleType ruleType() { return this.ruleType; } @@ -163,15 +167,19 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.maxCodeLen); } - generator.writeKey("name_type"); - this.nameType.serialize(generator, mapper); + if (this.nameType != null) { + generator.writeKey("name_type"); + this.nameType.serialize(generator, mapper); + } if (this.replace != null) { generator.writeKey("replace"); generator.write(this.replace); } - generator.writeKey("rule_type"); - this.ruleType.serialize(generator, mapper); + if (this.ruleType != null) { + generator.writeKey("rule_type"); + this.ruleType.serialize(generator, mapper); + } } @@ -186,16 +194,19 @@ public static class Builder extends TokenFilterBase.AbstractBuilder ObjectBuilder { private PhoneticEncoder encoder; + @Nullable private List languageset; @Nullable private Integer maxCodeLen; + @Nullable private PhoneticNameType nameType; @Nullable private Boolean replace; + @Nullable private PhoneticRuleType ruleType; /** @@ -207,7 +218,7 @@ public final Builder encoder(PhoneticEncoder value) { } /** - * Required - API name: {@code languageset} + * API name: {@code languageset} *

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

* Adds one or more values to languageset. */ @@ -235,9 +246,9 @@ public final Builder maxCodeLen(@Nullable Integer value) { } /** - * Required - API name: {@code name_type} + * API name: {@code name_type} */ - public final Builder nameType(PhoneticNameType value) { + public final Builder nameType(@Nullable PhoneticNameType value) { this.nameType = value; return this; } @@ -251,9 +262,9 @@ public final Builder replace(@Nullable Boolean value) { } /** - * Required - API name: {@code rule_type} + * API name: {@code rule_type} */ - public final Builder ruleType(PhoneticRuleType value) { + public final Builder ruleType(@Nullable PhoneticRuleType value) { this.ruleType = value; return this; } 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 45b888708..a0dd272f0 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 @@ -1681,11 +1681,16 @@ 'ingest._types.UserAgentProperty': 'ingest/_types/Processors.ts#L266-L277', 'ingest.delete_pipeline.Request': 'ingest/delete_pipeline/DeletePipelineRequest.ts#L24-L52', 'ingest.delete_pipeline.Response': 'ingest/delete_pipeline/DeletePipelineResponse.ts#L22-L24', -'ingest.geo_ip_stats.GeoIpDownloadStatistics': 'ingest/geo_ip_stats/types.ts#L24-L35', -'ingest.geo_ip_stats.GeoIpNodeDatabaseName': 'ingest/geo_ip_stats/types.ts#L45-L48', -'ingest.geo_ip_stats.GeoIpNodeDatabases': 'ingest/geo_ip_stats/types.ts#L37-L43', +'ingest.geo_ip_stats.GeoIpDownloadStatistics': 'ingest/geo_ip_stats/types.ts#L24-L37', +'ingest.geo_ip_stats.GeoIpNodeDatabaseName': 'ingest/geo_ip_stats/types.ts#L47-L50', +'ingest.geo_ip_stats.GeoIpNodeDatabases': 'ingest/geo_ip_stats/types.ts#L39-L45', 'ingest.geo_ip_stats.Request': 'ingest/geo_ip_stats/IngestGeoIpStatsRequest.ts#L22-L29', 'ingest.geo_ip_stats.Response': 'ingest/geo_ip_stats/IngestGeoIpStatsResponse.ts#L24-L31', +'ingest.get_geoip_database.DatabaseConfiguration': 'ingest/get_geoip_database/GetGeoipDatabaseResponse.ts#L35-L38', +'ingest.get_geoip_database.DatabaseConfigurationMetadata': 'ingest/get_geoip_database/GetGeoipDatabaseResponse.ts#L28-L33', +'ingest.get_geoip_database.Maxmind': 'ingest/get_geoip_database/GetGeoipDatabaseResponse.ts#L40-L42', +'ingest.get_geoip_database.Request': 'ingest/get_geoip_database/GetGeoipDatabaseRequest.ts#L24-L46', +'ingest.get_geoip_database.Response': 'ingest/get_geoip_database/GetGeoipDatabaseResponse.ts#L24-L26', 'ingest.get_pipeline.Request': 'ingest/get_pipeline/GetPipelineRequest.ts#L24-L50', 'ingest.get_pipeline.Response': 'ingest/get_pipeline/GetPipelineResponse.ts#L23-L26', 'ingest.processor_grok.Request': 'ingest/processor_grok/GrokProcessorPatternsRequest.ts#L22-L31', @@ -2842,10 +2847,10 @@ if (hash.length > 1) { hash = hash.substring(1); } - window.location = "https://github.com/elastic/elasticsearch-specification/tree/80d8b44424441c00001ed25673bf63a9cb4cb2cd/specification/" + (paths[hash] || ""); + window.location = "https://github.com/elastic/elasticsearch-specification/tree/b385d5edde19fc2e435eba2f334b00175ec5ef10/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/ingest/ElasticsearchIngestAsyncClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/ElasticsearchIngestAsyncClient.java index 3165a4dbb..be1dabe06 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/ElasticsearchIngestAsyncClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/ElasticsearchIngestAsyncClient.java @@ -112,6 +112,52 @@ public CompletableFuture geoIpStats() { this.transportOptions); } + // ----- Endpoint: ingest.get_geoip_database + + /** + * Returns information about one or more geoip database configurations. + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture getGeoipDatabase(GetGeoipDatabaseRequest request) { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) GetGeoipDatabaseRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Returns information about one or more geoip database configurations. + * + * @param fn + * a function that initializes a builder to create the + * {@link GetGeoipDatabaseRequest} + * @see Documentation + * on elastic.co + */ + + public final CompletableFuture getGeoipDatabase( + Function> fn) { + return getGeoipDatabase(fn.apply(new GetGeoipDatabaseRequest.Builder()).build()); + } + + /** + * Returns information about one or more geoip database configurations. + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture getGeoipDatabase() { + return this.transport.performRequestAsync(new GetGeoipDatabaseRequest.Builder().build(), + GetGeoipDatabaseRequest._ENDPOINT, this.transportOptions); + } + // ----- Endpoint: ingest.get_pipeline /** diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/ElasticsearchIngestClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/ElasticsearchIngestClient.java index a4a371cee..994b8459b 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/ElasticsearchIngestClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/ElasticsearchIngestClient.java @@ -114,6 +114,54 @@ public GeoIpStatsResponse geoIpStats() throws IOException, ElasticsearchExceptio this.transportOptions); } + // ----- Endpoint: ingest.get_geoip_database + + /** + * Returns information about one or more geoip database configurations. + * + * @see Documentation + * on elastic.co + */ + + public GetGeoipDatabaseResponse getGeoipDatabase(GetGeoipDatabaseRequest request) + throws IOException, ElasticsearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) GetGeoipDatabaseRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Returns information about one or more geoip database configurations. + * + * @param fn + * a function that initializes a builder to create the + * {@link GetGeoipDatabaseRequest} + * @see Documentation + * on elastic.co + */ + + public final GetGeoipDatabaseResponse getGeoipDatabase( + Function> fn) + throws IOException, ElasticsearchException { + return getGeoipDatabase(fn.apply(new GetGeoipDatabaseRequest.Builder()).build()); + } + + /** + * Returns information about one or more geoip database configurations. + * + * @see Documentation + * on elastic.co + */ + + public GetGeoipDatabaseResponse getGeoipDatabase() throws IOException, ElasticsearchException { + return this.transport.performRequest(new GetGeoipDatabaseRequest.Builder().build(), + GetGeoipDatabaseRequest._ENDPOINT, this.transportOptions); + } + // ----- Endpoint: ingest.get_pipeline /** diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/GetGeoipDatabaseRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/GetGeoipDatabaseRequest.java new file mode 100644 index 000000000..d25608a2e --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/GetGeoipDatabaseRequest.java @@ -0,0 +1,261 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package co.elastic.clients.elasticsearch.ingest; + +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.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.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +import java.lang.String; +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; +import javax.annotation.Nullable; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: ingest.get_geoip_database.Request + +/** + * Returns information about one or more geoip database configurations. + * + * @see API + * specification + */ + +public class GetGeoipDatabaseRequest extends RequestBase { + private final List id; + + @Nullable + private final Time masterTimeout; + + // --------------------------------------------------------------------------------------------- + + private GetGeoipDatabaseRequest(Builder builder) { + + this.id = ApiTypeHelper.unmodifiable(builder.id); + this.masterTimeout = builder.masterTimeout; + + } + + public static GetGeoipDatabaseRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Comma-separated list of database configuration IDs to retrieve. Wildcard + * (*) expressions are supported. To get all database + * configurations, omit this parameter or use *. + *

+ * API name: {@code id} + */ + public final List id() { + return this.id; + } + + /** + * 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 Time masterTimeout() { + return this.masterTimeout; + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link GetGeoipDatabaseRequest}. + */ + + public static class Builder extends RequestBase.AbstractBuilder + implements + ObjectBuilder { + @Nullable + private List id; + + @Nullable + private Time masterTimeout; + + /** + * Comma-separated list of database configuration IDs to retrieve. Wildcard + * (*) expressions are supported. To get all database + * configurations, omit this parameter or use *. + *

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

+ * Adds all elements of list to id. + */ + public final Builder id(List list) { + this.id = _listAddAll(this.id, list); + return this; + } + + /** + * Comma-separated list of database configuration IDs to retrieve. Wildcard + * (*) expressions are supported. To get all database + * configurations, omit this parameter or use *. + *

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

+ * Adds one or more values to id. + */ + public final Builder id(String value, String... values) { + this.id = _listAdd(this.id, value, values); + 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 Time value) { + this.masterTimeout = 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(Function> fn) { + return this.masterTimeout(fn.apply(new Time.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link GetGeoipDatabaseRequest}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public GetGeoipDatabaseRequest build() { + _checkSingleUse(); + + return new GetGeoipDatabaseRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code ingest.get_geoip_database}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/ingest.get_geoip_database", + + // Request method + request -> { + return "GET"; + + }, + + // Request path + request -> { + final int _id = 1 << 0; + + int propsSet = 0; + + if (ApiTypeHelper.isDefined(request.id())) + propsSet |= _id; + + if (propsSet == 0) { + StringBuilder buf = new StringBuilder(); + buf.append("/_ingest"); + buf.append("/geoip"); + buf.append("/database"); + return buf.toString(); + } + if (propsSet == (_id)) { + StringBuilder buf = new StringBuilder(); + buf.append("/_ingest"); + buf.append("/geoip"); + buf.append("/database"); + buf.append("/"); + SimpleEndpoint.pathEncode(request.id.stream().map(v -> v).collect(Collectors.joining(",")), buf); + return buf.toString(); + } + throw SimpleEndpoint.noPathTemplateFound("path"); + + }, + + // Path parameters + request -> { + Map params = new HashMap<>(); + final int _id = 1 << 0; + + int propsSet = 0; + + if (ApiTypeHelper.isDefined(request.id())) + propsSet |= _id; + + if (propsSet == 0) { + } + if (propsSet == (_id)) { + params.put("id", request.id.stream().map(v -> v).collect(Collectors.joining(","))); + } + return params; + }, + + // Request parameters + request -> { + Map params = new HashMap<>(); + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); + } + return params; + + }, SimpleEndpoint.emptyMap(), false, GetGeoipDatabaseResponse._DESERIALIZER); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/GetGeoipDatabaseResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/GetGeoipDatabaseResponse.java new file mode 100644 index 000000000..022cd766e --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/GetGeoipDatabaseResponse.java @@ -0,0 +1,189 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package co.elastic.clients.elasticsearch.ingest; + +import co.elastic.clients.elasticsearch.ingest.get_geoip_database.DatabaseConfigurationMetadata; +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; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: ingest.get_geoip_database.Response + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class GetGeoipDatabaseResponse implements JsonpSerializable { + private final List databases; + + // --------------------------------------------------------------------------------------------- + + private GetGeoipDatabaseResponse(Builder builder) { + + this.databases = ApiTypeHelper.unmodifiableRequired(builder.databases, this, "databases"); + + } + + public static GetGeoipDatabaseResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code databases} + */ + public final List databases() { + return this.databases; + } + + /** + * 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.databases)) { + generator.writeKey("databases"); + generator.writeStartArray(); + for (DatabaseConfigurationMetadata item0 : this.databases) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link GetGeoipDatabaseResponse}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private List databases; + + /** + * Required - API name: {@code databases} + *

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

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

+ * Adds a value to databases using a builder lambda. + */ + public final Builder databases( + Function> fn) { + return databases(fn.apply(new DatabaseConfigurationMetadata.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link GetGeoipDatabaseResponse}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public GetGeoipDatabaseResponse build() { + _checkSingleUse(); + + return new GetGeoipDatabaseResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link GetGeoipDatabaseResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, GetGeoipDatabaseResponse::setupGetGeoipDatabaseResponseDeserializer); + + protected static void setupGetGeoipDatabaseResponseDeserializer( + ObjectDeserializer op) { + + op.add(Builder::databases, JsonpDeserializer.arrayDeserializer(DatabaseConfigurationMetadata._DESERIALIZER), + "databases"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/geo_ip_stats/GeoIpDownloadStatistics.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/geo_ip_stats/GeoIpDownloadStatistics.java index b0d8dbbf4..470b42f71 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/geo_ip_stats/GeoIpDownloadStatistics.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/geo_ip_stats/GeoIpDownloadStatistics.java @@ -66,10 +66,12 @@ public class GeoIpDownloadStatistics implements JsonpSerializable { private final long totalDownloadTime; - private final int databaseCount; + private final int databasesCount; private final int skippedUpdates; + private final int expiredDatabases; + // --------------------------------------------------------------------------------------------- private GeoIpDownloadStatistics(Builder builder) { @@ -78,8 +80,9 @@ private GeoIpDownloadStatistics(Builder builder) { "successfulDownloads"); this.failedDownloads = ApiTypeHelper.requireNonNull(builder.failedDownloads, this, "failedDownloads"); this.totalDownloadTime = ApiTypeHelper.requireNonNull(builder.totalDownloadTime, this, "totalDownloadTime"); - this.databaseCount = ApiTypeHelper.requireNonNull(builder.databaseCount, this, "databaseCount"); + this.databasesCount = ApiTypeHelper.requireNonNull(builder.databasesCount, this, "databasesCount"); this.skippedUpdates = ApiTypeHelper.requireNonNull(builder.skippedUpdates, this, "skippedUpdates"); + this.expiredDatabases = ApiTypeHelper.requireNonNull(builder.expiredDatabases, this, "expiredDatabases"); } @@ -117,10 +120,10 @@ public final long totalDownloadTime() { /** * Required - Current number of databases available for use. *

- * API name: {@code database_count} + * API name: {@code databases_count} */ - public final int databaseCount() { - return this.databaseCount; + public final int databasesCount() { + return this.databasesCount; } /** @@ -132,6 +135,15 @@ public final int skippedUpdates() { return this.skippedUpdates; } + /** + * Required - Total number of databases not updated after 30 days + *

+ * API name: {@code expired_databases} + */ + public final int expiredDatabases() { + return this.expiredDatabases; + } + /** * Serialize this object to JSON. */ @@ -152,12 +164,15 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("total_download_time"); generator.write(this.totalDownloadTime); - generator.writeKey("database_count"); - generator.write(this.databaseCount); + generator.writeKey("databases_count"); + generator.write(this.databasesCount); generator.writeKey("skipped_updates"); generator.write(this.skippedUpdates); + generator.writeKey("expired_databases"); + generator.write(this.expiredDatabases); + } @Override @@ -180,10 +195,12 @@ public static class Builder extends WithJsonObjectBuilderBase private Long totalDownloadTime; - private Integer databaseCount; + private Integer databasesCount; private Integer skippedUpdates; + private Integer expiredDatabases; + /** * Required - Total number of successful database downloads. *

@@ -217,10 +234,10 @@ public final Builder totalDownloadTime(long value) { /** * Required - Current number of databases available for use. *

- * API name: {@code database_count} + * API name: {@code databases_count} */ - public final Builder databaseCount(int value) { - this.databaseCount = value; + public final Builder databasesCount(int value) { + this.databasesCount = value; return this; } @@ -234,6 +251,16 @@ public final Builder skippedUpdates(int value) { return this; } + /** + * Required - Total number of databases not updated after 30 days + *

+ * API name: {@code expired_databases} + */ + public final Builder expiredDatabases(int value) { + this.expiredDatabases = value; + return this; + } + @Override protected Builder self() { return this; @@ -266,8 +293,9 @@ protected static void setupGeoIpDownloadStatisticsDeserializer( op.add(Builder::successfulDownloads, JsonpDeserializer.integerDeserializer(), "successful_downloads"); op.add(Builder::failedDownloads, JsonpDeserializer.integerDeserializer(), "failed_downloads"); op.add(Builder::totalDownloadTime, JsonpDeserializer.longDeserializer(), "total_download_time"); - op.add(Builder::databaseCount, JsonpDeserializer.integerDeserializer(), "database_count"); + op.add(Builder::databasesCount, JsonpDeserializer.integerDeserializer(), "databases_count"); op.add(Builder::skippedUpdates, JsonpDeserializer.integerDeserializer(), "skipped_updates"); + op.add(Builder::expiredDatabases, JsonpDeserializer.integerDeserializer(), "expired_databases"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/get_geoip_database/DatabaseConfiguration.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/get_geoip_database/DatabaseConfiguration.java new file mode 100644 index 000000000..9b425b11b --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/get_geoip_database/DatabaseConfiguration.java @@ -0,0 +1,187 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package co.elastic.clients.elasticsearch.ingest.get_geoip_database; + +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; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: ingest.get_geoip_database.DatabaseConfiguration + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class DatabaseConfiguration implements JsonpSerializable { + private final String name; + + private final Maxmind maxmind; + + // --------------------------------------------------------------------------------------------- + + private DatabaseConfiguration(Builder builder) { + + this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); + this.maxmind = ApiTypeHelper.requireNonNull(builder.maxmind, this, "maxmind"); + + } + + public static DatabaseConfiguration 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 maxmind} + */ + public final Maxmind maxmind() { + return this.maxmind; + } + + /** + * 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("maxmind"); + this.maxmind.serialize(generator, mapper); + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DatabaseConfiguration}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private String name; + + private Maxmind maxmind; + + /** + * Required - API name: {@code name} + */ + public final Builder name(String value) { + this.name = value; + return this; + } + + /** + * Required - API name: {@code maxmind} + */ + public final Builder maxmind(Maxmind value) { + this.maxmind = value; + return this; + } + + /** + * Required - API name: {@code maxmind} + */ + public final Builder maxmind(Function> fn) { + return this.maxmind(fn.apply(new Maxmind.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link DatabaseConfiguration}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public DatabaseConfiguration build() { + _checkSingleUse(); + + return new DatabaseConfiguration(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DatabaseConfiguration} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, DatabaseConfiguration::setupDatabaseConfigurationDeserializer); + + protected static void setupDatabaseConfigurationDeserializer(ObjectDeserializer op) { + + op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); + op.add(Builder::maxmind, Maxmind._DESERIALIZER, "maxmind"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/get_geoip_database/DatabaseConfigurationMetadata.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/get_geoip_database/DatabaseConfigurationMetadata.java new file mode 100644 index 000000000..e60e80755 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/get_geoip_database/DatabaseConfigurationMetadata.java @@ -0,0 +1,238 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package co.elastic.clients.elasticsearch.ingest.get_geoip_database; + +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.Long; +import java.lang.String; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: ingest.get_geoip_database.DatabaseConfigurationMetadata + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class DatabaseConfigurationMetadata implements JsonpSerializable { + private final String id; + + private final long version; + + private final long modifiedDateMillis; + + private final DatabaseConfiguration database; + + // --------------------------------------------------------------------------------------------- + + private DatabaseConfigurationMetadata(Builder builder) { + + this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id"); + this.version = ApiTypeHelper.requireNonNull(builder.version, this, "version"); + this.modifiedDateMillis = ApiTypeHelper.requireNonNull(builder.modifiedDateMillis, this, "modifiedDateMillis"); + this.database = ApiTypeHelper.requireNonNull(builder.database, this, "database"); + + } + + public static DatabaseConfigurationMetadata of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code id} + */ + public final String id() { + return this.id; + } + + /** + * Required - API name: {@code version} + */ + public final long version() { + return this.version; + } + + /** + * Required - API name: {@code modified_date_millis} + */ + public final long modifiedDateMillis() { + return this.modifiedDateMillis; + } + + /** + * Required - API name: {@code database} + */ + public final DatabaseConfiguration database() { + return this.database; + } + + /** + * 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("id"); + generator.write(this.id); + + generator.writeKey("version"); + generator.write(this.version); + + generator.writeKey("modified_date_millis"); + generator.write(this.modifiedDateMillis); + + generator.writeKey("database"); + this.database.serialize(generator, mapper); + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DatabaseConfigurationMetadata}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private String id; + + private Long version; + + private Long modifiedDateMillis; + + private DatabaseConfiguration database; + + /** + * Required - API name: {@code id} + */ + public final Builder id(String value) { + this.id = value; + return this; + } + + /** + * Required - API name: {@code version} + */ + public final Builder version(long value) { + this.version = value; + return this; + } + + /** + * Required - API name: {@code modified_date_millis} + */ + public final Builder modifiedDateMillis(long value) { + this.modifiedDateMillis = value; + return this; + } + + /** + * Required - API name: {@code database} + */ + public final Builder database(DatabaseConfiguration value) { + this.database = value; + return this; + } + + /** + * Required - API name: {@code database} + */ + public final Builder database( + Function> fn) { + return this.database(fn.apply(new DatabaseConfiguration.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link DatabaseConfigurationMetadata}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public DatabaseConfigurationMetadata build() { + _checkSingleUse(); + + return new DatabaseConfigurationMetadata(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DatabaseConfigurationMetadata} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, DatabaseConfigurationMetadata::setupDatabaseConfigurationMetadataDeserializer); + + protected static void setupDatabaseConfigurationMetadataDeserializer( + ObjectDeserializer op) { + + op.add(Builder::id, JsonpDeserializer.stringDeserializer(), "id"); + op.add(Builder::version, JsonpDeserializer.longDeserializer(), "version"); + op.add(Builder::modifiedDateMillis, JsonpDeserializer.longDeserializer(), "modified_date_millis"); + op.add(Builder::database, DatabaseConfiguration._DESERIALIZER, "database"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/get_geoip_database/Maxmind.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/get_geoip_database/Maxmind.java new file mode 100644 index 000000000..f32f95263 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/get_geoip_database/Maxmind.java @@ -0,0 +1,154 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package co.elastic.clients.elasticsearch.ingest.get_geoip_database; + +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; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: ingest.get_geoip_database.Maxmind + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class Maxmind implements JsonpSerializable { + private final String accountId; + + // --------------------------------------------------------------------------------------------- + + private Maxmind(Builder builder) { + + this.accountId = ApiTypeHelper.requireNonNull(builder.accountId, this, "accountId"); + + } + + public static Maxmind of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code account_id} + */ + public final String accountId() { + return this.accountId; + } + + /** + * 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("account_id"); + generator.write(this.accountId); + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link Maxmind}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + private String accountId; + + /** + * Required - API name: {@code account_id} + */ + public final Builder accountId(String value) { + this.accountId = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link Maxmind}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public Maxmind build() { + _checkSingleUse(); + + return new Maxmind(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link Maxmind} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + Maxmind::setupMaxmindDeserializer); + + protected static void setupMaxmindDeserializer(ObjectDeserializer op) { + + op.add(Builder::accountId, JsonpDeserializer.stringDeserializer(), "account_id"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/InferenceResponseResult.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/InferenceResponseResult.java index 42e6eebe7..63b857ce1 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/InferenceResponseResult.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/InferenceResponseResult.java @@ -19,7 +19,7 @@ package co.elastic.clients.elasticsearch.ml; -import co.elastic.clients.json.JsonData; +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; @@ -69,7 +69,7 @@ public class InferenceResponseResult implements JsonpSerializable { @Nullable private final Boolean isTruncated; - private final List predictedValue; + private final List predictedValue; @Nullable private final String predictedValueSequence; @@ -139,7 +139,7 @@ public final Boolean isTruncated() { *

* API name: {@code predicted_value} */ - public final List predictedValue() { + public final List predictedValue() { return this.predictedValue; } @@ -233,7 +233,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (ApiTypeHelper.isDefined(this.predictedValue)) { generator.writeKey("predicted_value"); generator.writeStartArray(); - for (JsonData item0 : this.predictedValue) { + for (FieldValue item0 : this.predictedValue) { item0.serialize(generator, mapper); } @@ -304,7 +304,7 @@ public static class Builder extends WithJsonObjectBuilderBase private Boolean isTruncated; @Nullable - private List predictedValue; + private List predictedValue; @Nullable private String predictedValueSequence; @@ -386,7 +386,7 @@ public final Builder isTruncated(@Nullable Boolean 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; } @@ -404,11 +404,28 @@ public final Builder predictedValue(List list) { *

* Adds one or more values to predictedValue. */ - public final Builder predictedValue(JsonData value, JsonData... 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. Additionally @@ -559,7 +576,8 @@ protected static void setupInferenceResponseResultDeserializer( op.add(Builder::entities, JsonpDeserializer.arrayDeserializer(TrainedModelEntities._DESERIALIZER), "entities"); op.add(Builder::isTruncated, JsonpDeserializer.booleanDeserializer(), "is_truncated"); - op.add(Builder::predictedValue, JsonpDeserializer.arrayDeserializer(JsonData._DESERIALIZER), "predicted_value"); + 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");