From 0cbcc30fccf2685d2d41692cd469a83787bce559 Mon Sep 17 00:00:00 2001 From: Laura Trotta Date: Tue, 1 Oct 2024 18:33:06 +0200 Subject: [PATCH] fixes from spec pr 2959 --- .../_types/ShardsOperationResponseBase.java | 21 ++- .../_types/analysis/EdgeNGramTokenizer.java | 42 +++-- .../_types/analysis/NGramTokenizer.java | 42 +++-- .../elasticsearch/doc-files/api-spec.html | 53 +++--- .../elasticsearch/ilm/MoveToStepRequest.java | 39 ++-- .../ilm/move_to_step/StepKey.java | 34 ++-- .../indices/DataStreamVisibility.java | 29 +++ .../elasticsearch/ingest/RedactProcessor.java | 37 ++++ .../elasticsearch/ingest/simulate/Ingest.java | 36 ++++ .../elasticsearch/ingest/simulate/Redact.java | 156 ++++++++++++++++ .../elasticsearch/xpack/info/Features.java | 173 ++++++------------ 11 files changed, 447 insertions(+), 215 deletions(-) create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/simulate/Redact.java diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/ShardsOperationResponseBase.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/ShardsOperationResponseBase.java index a2064e050..1dc2ded74 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/ShardsOperationResponseBase.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/ShardsOperationResponseBase.java @@ -26,7 +26,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; @@ -59,19 +58,21 @@ */ public abstract class ShardsOperationResponseBase implements JsonpSerializable { + @Nullable private final ShardStatistics shards; // --------------------------------------------------------------------------------------------- protected ShardsOperationResponseBase(AbstractBuilder builder) { - this.shards = ApiTypeHelper.requireNonNull(builder.shards, this, "shards"); + this.shards = builder.shards; } /** - * Required - API name: {@code _shards} + * API name: {@code _shards} */ + @Nullable public final ShardStatistics shards() { return this.shards; } @@ -87,8 +88,11 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("_shards"); - this.shards.serialize(generator, mapper); + if (this.shards != null) { + generator.writeKey("_shards"); + this.shards.serialize(generator, mapper); + + } } @@ -100,18 +104,19 @@ public String toString() { public abstract static class AbstractBuilder> extends WithJsonObjectBuilderBase { + @Nullable private ShardStatistics shards; /** - * Required - API name: {@code _shards} + * API name: {@code _shards} */ - public final BuilderT shards(ShardStatistics value) { + public final BuilderT shards(@Nullable ShardStatistics value) { this.shards = value; return self(); } /** - * Required - API name: {@code _shards} + * API name: {@code _shards} */ public final BuilderT shards(Function> fn) { return this.shards(fn.apply(new ShardStatistics.Builder()).build()); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/EdgeNGramTokenizer.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/EdgeNGramTokenizer.java index fa7e1e77c..7b587e7dd 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/EdgeNGramTokenizer.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/EdgeNGramTokenizer.java @@ -62,9 +62,11 @@ public class EdgeNGramTokenizer extends TokenizerBase implements TokenizerDefini @Nullable private final String customTokenChars; - private final int maxGram; + @Nullable + private final Integer maxGram; - private final int minGram; + @Nullable + private final Integer minGram; private final List tokenChars; @@ -74,8 +76,8 @@ private EdgeNGramTokenizer(Builder builder) { super(builder); this.customTokenChars = builder.customTokenChars; - this.maxGram = ApiTypeHelper.requireNonNull(builder.maxGram, this, "maxGram"); - this.minGram = ApiTypeHelper.requireNonNull(builder.minGram, this, "minGram"); + this.maxGram = builder.maxGram; + this.minGram = builder.minGram; this.tokenChars = ApiTypeHelper.unmodifiable(builder.tokenChars); } @@ -101,16 +103,18 @@ public final String customTokenChars() { } /** - * Required - API name: {@code max_gram} + * API name: {@code max_gram} */ - public final int maxGram() { + @Nullable + public final Integer maxGram() { return this.maxGram; } /** - * Required - API name: {@code min_gram} + * API name: {@code min_gram} */ - public final int minGram() { + @Nullable + public final Integer minGram() { return this.minGram; } @@ -130,12 +134,16 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.customTokenChars); } - generator.writeKey("max_gram"); - generator.write(this.maxGram); + if (this.maxGram != null) { + generator.writeKey("max_gram"); + generator.write(this.maxGram); - generator.writeKey("min_gram"); - generator.write(this.minGram); + } + if (this.minGram != null) { + generator.writeKey("min_gram"); + generator.write(this.minGram); + } if (ApiTypeHelper.isDefined(this.tokenChars)) { generator.writeKey("token_chars"); generator.writeStartArray(); @@ -160,8 +168,10 @@ public static class Builder extends TokenizerBase.AbstractBuilder @Nullable private String customTokenChars; + @Nullable private Integer maxGram; + @Nullable private Integer minGram; @Nullable @@ -176,17 +186,17 @@ public final Builder customTokenChars(@Nullable String value) { } /** - * Required - API name: {@code max_gram} + * API name: {@code max_gram} */ - public final Builder maxGram(int value) { + public final Builder maxGram(@Nullable Integer value) { this.maxGram = value; return this; } /** - * Required - API name: {@code min_gram} + * API name: {@code min_gram} */ - public final Builder minGram(int value) { + public final Builder minGram(@Nullable Integer value) { this.minGram = value; return this; } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/NGramTokenizer.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/NGramTokenizer.java index a9078eada..182048458 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/NGramTokenizer.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/NGramTokenizer.java @@ -62,9 +62,11 @@ public class NGramTokenizer extends TokenizerBase implements TokenizerDefinition @Nullable private final String customTokenChars; - private final int maxGram; + @Nullable + private final Integer maxGram; - private final int minGram; + @Nullable + private final Integer minGram; private final List tokenChars; @@ -74,8 +76,8 @@ private NGramTokenizer(Builder builder) { super(builder); this.customTokenChars = builder.customTokenChars; - this.maxGram = ApiTypeHelper.requireNonNull(builder.maxGram, this, "maxGram"); - this.minGram = ApiTypeHelper.requireNonNull(builder.minGram, this, "minGram"); + this.maxGram = builder.maxGram; + this.minGram = builder.minGram; this.tokenChars = ApiTypeHelper.unmodifiable(builder.tokenChars); } @@ -101,16 +103,18 @@ public final String customTokenChars() { } /** - * Required - API name: {@code max_gram} + * API name: {@code max_gram} */ - public final int maxGram() { + @Nullable + public final Integer maxGram() { return this.maxGram; } /** - * Required - API name: {@code min_gram} + * API name: {@code min_gram} */ - public final int minGram() { + @Nullable + public final Integer minGram() { return this.minGram; } @@ -130,12 +134,16 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.customTokenChars); } - generator.writeKey("max_gram"); - generator.write(this.maxGram); + if (this.maxGram != null) { + generator.writeKey("max_gram"); + generator.write(this.maxGram); - generator.writeKey("min_gram"); - generator.write(this.minGram); + } + if (this.minGram != null) { + generator.writeKey("min_gram"); + generator.write(this.minGram); + } if (ApiTypeHelper.isDefined(this.tokenChars)) { generator.writeKey("token_chars"); generator.writeStartArray(); @@ -160,8 +168,10 @@ public static class Builder extends TokenizerBase.AbstractBuilder @Nullable private String customTokenChars; + @Nullable private Integer maxGram; + @Nullable private Integer minGram; @Nullable @@ -176,17 +186,17 @@ public final Builder customTokenChars(@Nullable String value) { } /** - * Required - API name: {@code max_gram} + * API name: {@code max_gram} */ - public final Builder maxGram(int value) { + public final Builder maxGram(@Nullable Integer value) { this.maxGram = value; return this; } /** - * Required - API name: {@code min_gram} + * API name: {@code min_gram} */ - public final Builder minGram(int value) { + public final Builder minGram(@Nullable Integer value) { this.minGram = 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 5c6e74df9..f9cec7c88 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 @@ -345,7 +345,7 @@ '_types.SegmentsStats': '_types/Stats.ts#L273-L366', '_types.ShardFailure': '_types/Errors.ts#L52-L58', '_types.ShardStatistics': '_types/Stats.ts#L54-L66', -'_types.ShardsOperationResponseBase': '_types/Base.ts#L91-L93', +'_types.ShardsOperationResponseBase': '_types/Base.ts#L91-L94', '_types.SlicedScroll': '_types/SlicedScroll.ts#L23-L27', '_types.Slices': '_types/common.ts#L365-L370', '_types.SlicesCalculation': '_types/common.ts#L372-L380', @@ -1391,7 +1391,7 @@ 'ilm.migrate_to_data_tiers.Response': 'ilm/migrate_to_data_tiers/Response.ts#L22-L32', 'ilm.move_to_step.Request': 'ilm/move_to_step/MoveToStepRequest.ts#L24-L36', 'ilm.move_to_step.Response': 'ilm/move_to_step/MoveToStepResponse.ts#L22-L24', -'ilm.move_to_step.StepKey': 'ilm/move_to_step/types.ts#L20-L24', +'ilm.move_to_step.StepKey': 'ilm/move_to_step/types.ts#L20-L25', 'ilm.put_lifecycle.Request': 'ilm/put_lifecycle/PutLifecycleRequest.ts#L25-L55', 'ilm.put_lifecycle.Response': 'ilm/put_lifecycle/PutLifecycleResponse.ts#L22-L24', 'ilm.remove_policy.Request': 'ilm/remove_policy/RemovePolicyRequest.ts#L23-L31', @@ -1412,7 +1412,7 @@ 'indices._types.DataStreamLifecycleRolloverConditions': 'indices/_types/DataStreamLifecycle.ts#L57-L69', 'indices._types.DataStreamLifecycleWithRollover': 'indices/_types/DataStreamLifecycle.ts#L33-L55', 'indices._types.DataStreamTimestampField': 'indices/_types/DataStream.ts#L129-L134', -'indices._types.DataStreamVisibility': 'indices/_types/DataStream.ts#L159-L161', +'indices._types.DataStreamVisibility': 'indices/_types/DataStream.ts#L159-L162', 'indices._types.DownsampleConfig': 'indices/_types/Downsample.ts#L22-L27', 'indices._types.DownsamplingRound': 'indices/_types/DownsamplingRound.ts#L23-L32', 'indices._types.FailureStore': 'indices/_types/DataStream.ts#L39-L43', @@ -1730,20 +1730,20 @@ 'ingest._types.PipelineProcessor': 'ingest/_types/Processors.ts#L1043-L1054', 'ingest._types.ProcessorBase': 'ingest/_types/Processors.ts#L266-L289', 'ingest._types.ProcessorContainer': 'ingest/_types/Processors.ts#L27-L264', -'ingest._types.RedactProcessor': 'ingest/_types/Processors.ts#L1056-L1090', -'ingest._types.RemoveProcessor': 'ingest/_types/Processors.ts#L1092-L1106', -'ingest._types.RenameProcessor': 'ingest/_types/Processors.ts#L1108-L1124', -'ingest._types.RerouteProcessor': 'ingest/_types/Processors.ts#L1126-L1154', -'ingest._types.ScriptProcessor': 'ingest/_types/Processors.ts#L1156-L1176', -'ingest._types.SetProcessor': 'ingest/_types/Processors.ts#L1178-L1212', -'ingest._types.SetSecurityUserProcessor': 'ingest/_types/Processors.ts#L1214-L1223', -'ingest._types.ShapeType': 'ingest/_types/Processors.ts#L1225-L1228', -'ingest._types.SortProcessor': 'ingest/_types/Processors.ts#L1230-L1246', -'ingest._types.SplitProcessor': 'ingest/_types/Processors.ts#L1248-L1273', -'ingest._types.TrimProcessor': 'ingest/_types/Processors.ts#L1275-L1291', -'ingest._types.UppercaseProcessor': 'ingest/_types/Processors.ts#L1293-L1309', -'ingest._types.UriPartsProcessor': 'ingest/_types/Processors.ts#L1329-L1355', -'ingest._types.UrlDecodeProcessor': 'ingest/_types/Processors.ts#L1311-L1327', +'ingest._types.RedactProcessor': 'ingest/_types/Processors.ts#L1056-L1097', +'ingest._types.RemoveProcessor': 'ingest/_types/Processors.ts#L1099-L1113', +'ingest._types.RenameProcessor': 'ingest/_types/Processors.ts#L1115-L1131', +'ingest._types.RerouteProcessor': 'ingest/_types/Processors.ts#L1133-L1161', +'ingest._types.ScriptProcessor': 'ingest/_types/Processors.ts#L1163-L1183', +'ingest._types.SetProcessor': 'ingest/_types/Processors.ts#L1185-L1219', +'ingest._types.SetSecurityUserProcessor': 'ingest/_types/Processors.ts#L1221-L1230', +'ingest._types.ShapeType': 'ingest/_types/Processors.ts#L1232-L1235', +'ingest._types.SortProcessor': 'ingest/_types/Processors.ts#L1237-L1253', +'ingest._types.SplitProcessor': 'ingest/_types/Processors.ts#L1255-L1280', +'ingest._types.TrimProcessor': 'ingest/_types/Processors.ts#L1282-L1298', +'ingest._types.UppercaseProcessor': 'ingest/_types/Processors.ts#L1300-L1316', +'ingest._types.UriPartsProcessor': 'ingest/_types/Processors.ts#L1336-L1362', +'ingest._types.UrlDecodeProcessor': 'ingest/_types/Processors.ts#L1318-L1334', 'ingest._types.UserAgentProcessor': 'ingest/_types/Processors.ts#L441-L472', 'ingest._types.UserAgentProperty': 'ingest/_types/Processors.ts#L474-L480', 'ingest.delete_geoip_database.Request': 'ingest/delete_geoip_database/DeleteGeoipDatabaseRequest.ts#L24-L48', @@ -1766,13 +1766,14 @@ 'ingest.put_geoip_database.Response': 'ingest/put_geoip_database/PutGeoipDatabaseResponse.ts#L22-L24', 'ingest.put_pipeline.Request': 'ingest/put_pipeline/PutPipelineRequest.ts#L25-L83', 'ingest.put_pipeline.Response': 'ingest/put_pipeline/PutPipelineResponse.ts#L22-L24', -'ingest.simulate.Document': 'ingest/simulate/types.ts#L50-L64', -'ingest.simulate.DocumentSimulation': 'ingest/simulate/types.ts#L66-L96', -'ingest.simulate.Ingest': 'ingest/simulate/types.ts#L29-L32', -'ingest.simulate.PipelineSimulation': 'ingest/simulate/types.ts#L40-L48', +'ingest.simulate.Document': 'ingest/simulate/types.ts#L62-L76', +'ingest.simulate.DocumentSimulation': 'ingest/simulate/types.ts#L78-L108', +'ingest.simulate.Ingest': 'ingest/simulate/types.ts#L29-L37', +'ingest.simulate.PipelineSimulation': 'ingest/simulate/types.ts#L52-L60', +'ingest.simulate.Redact': 'ingest/simulate/types.ts#L39-L44', 'ingest.simulate.Request': 'ingest/simulate/SimulatePipelineRequest.ts#L25-L57', 'ingest.simulate.Response': 'ingest/simulate/SimulatePipelineResponse.ts#L22-L24', -'ingest.simulate.SimulateDocumentResult': 'ingest/simulate/types.ts#L34-L38', +'ingest.simulate.SimulateDocumentResult': 'ingest/simulate/types.ts#L46-L50', 'license._types.License': 'license/_types/License.ts#L42-L53', 'license._types.LicenseStatus': 'license/_types/License.ts#L35-L40', 'license._types.LicenseType': 'license/_types/License.ts#L23-L33', @@ -2851,8 +2852,8 @@ 'watcher.stop.Request': 'watcher/stop/WatcherStopRequest.ts#L22-L26', 'watcher.stop.Response': 'watcher/stop/WatcherStopResponse.ts#L22-L24', 'xpack.info.BuildInformation': 'xpack/info/types.ts#L24-L27', -'xpack.info.Feature': 'xpack/info/types.ts#L77-L82', -'xpack.info.Features': 'xpack/info/types.ts#L42-L75', +'xpack.info.Feature': 'xpack/info/types.ts#L84-L89', +'xpack.info.Features': 'xpack/info/types.ts#L42-L82', 'xpack.info.MinimalLicenseInformation': 'xpack/info/types.ts#L34-L40', 'xpack.info.NativeCodeInformation': 'xpack/info/types.ts#L29-L32', 'xpack.info.Request': 'xpack/info/XPackInfoRequest.ts#L22-L42', @@ -2929,10 +2930,10 @@ if (hash.length > 1) { hash = hash.substring(1); } - window.location = "https://github.com/elastic/elasticsearch-specification/tree/aefa7a7149bde6df74dca802340ea4b1fcc70dfb/specification/" + (paths[hash] || ""); + window.location = "https://github.com/elastic/elasticsearch-specification/tree/3b1143a5a96fc7596af96485bccca492798d6f0e/specification/" + (paths[hash] || ""); - Please see the Elasticsearch API specification. + Please see the Elasticsearch API specification. diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/MoveToStepRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/MoveToStepRequest.java index c178272d7..2691be8ab 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/MoveToStepRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/MoveToStepRequest.java @@ -66,21 +66,19 @@ */ @JsonpDeserializable public class MoveToStepRequest extends RequestBase implements JsonpSerializable { - @Nullable private final StepKey currentStep; private final String index; - @Nullable private final StepKey nextStep; // --------------------------------------------------------------------------------------------- private MoveToStepRequest(Builder builder) { - this.currentStep = builder.currentStep; + this.currentStep = ApiTypeHelper.requireNonNull(builder.currentStep, this, "currentStep"); this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); - this.nextStep = builder.nextStep; + this.nextStep = ApiTypeHelper.requireNonNull(builder.nextStep, this, "nextStep"); } @@ -89,9 +87,8 @@ public static MoveToStepRequest of(Function implements ObjectBuilder { - @Nullable private StepKey currentStep; private String index; - @Nullable private StepKey nextStep; /** - * API name: {@code current_step} + * Required - API name: {@code current_step} */ - public final Builder currentStep(@Nullable StepKey value) { + public final Builder currentStep(StepKey value) { this.currentStep = value; return this; } /** - * API name: {@code current_step} + * Required - API name: {@code current_step} */ public final Builder currentStep(Function> fn) { return this.currentStep(fn.apply(new StepKey.Builder()).build()); @@ -180,15 +169,15 @@ public final Builder index(String value) { } /** - * API name: {@code next_step} + * Required - API name: {@code next_step} */ - public final Builder nextStep(@Nullable StepKey value) { + public final Builder nextStep(StepKey value) { this.nextStep = value; return this; } /** - * API name: {@code next_step} + * Required - API name: {@code next_step} */ public final Builder nextStep(Function> fn) { return this.nextStep(fn.apply(new StepKey.Builder()).build()); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/move_to_step/StepKey.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/move_to_step/StepKey.java index 2ab46ab63..f773f0fc3 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/move_to_step/StepKey.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/move_to_step/StepKey.java @@ -59,8 +59,10 @@ */ @JsonpDeserializable public class StepKey implements JsonpSerializable { + @Nullable private final String action; + @Nullable private final String name; private final String phase; @@ -69,8 +71,8 @@ public class StepKey implements JsonpSerializable { private StepKey(Builder builder) { - this.action = ApiTypeHelper.requireNonNull(builder.action, this, "action"); - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); + this.action = builder.action; + this.name = builder.name; this.phase = ApiTypeHelper.requireNonNull(builder.phase, this, "phase"); } @@ -80,15 +82,17 @@ public static StepKey of(Function> fn) { } /** - * Required - API name: {@code action} + * API name: {@code action} */ + @Nullable public final String action() { return this.action; } /** - * Required - API name: {@code name} + * API name: {@code name} */ + @Nullable public final String name() { return this.name; } @@ -111,12 +115,16 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("action"); - generator.write(this.action); + if (this.action != null) { + generator.writeKey("action"); + generator.write(this.action); - generator.writeKey("name"); - generator.write(this.name); + } + if (this.name != null) { + generator.writeKey("name"); + generator.write(this.name); + } generator.writeKey("phase"); generator.write(this.phase); @@ -134,24 +142,26 @@ public String toString() { */ public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + @Nullable private String action; + @Nullable private String name; private String phase; /** - * Required - API name: {@code action} + * API name: {@code action} */ - public final Builder action(String value) { + public final Builder action(@Nullable String value) { this.action = value; return this; } /** - * Required - API name: {@code name} + * API name: {@code name} */ - public final Builder name(String value) { + public final Builder name(@Nullable String value) { this.name = value; return this; } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DataStreamVisibility.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DataStreamVisibility.java index 9f562c19d..559e198bd 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DataStreamVisibility.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DataStreamVisibility.java @@ -62,11 +62,15 @@ public class DataStreamVisibility implements JsonpSerializable { @Nullable private final Boolean hidden; + @Nullable + private final Boolean allowCustomRouting; + // --------------------------------------------------------------------------------------------- private DataStreamVisibility(Builder builder) { this.hidden = builder.hidden; + this.allowCustomRouting = builder.allowCustomRouting; } @@ -82,6 +86,14 @@ public final Boolean hidden() { return this.hidden; } + /** + * API name: {@code allow_custom_routing} + */ + @Nullable + public final Boolean allowCustomRouting() { + return this.allowCustomRouting; + } + /** * Serialize this object to JSON. */ @@ -98,6 +110,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.hidden); } + if (this.allowCustomRouting != null) { + generator.writeKey("allow_custom_routing"); + generator.write(this.allowCustomRouting); + + } } @@ -118,6 +135,9 @@ public static class Builder extends WithJsonObjectBuilderBase @Nullable private Boolean hidden; + @Nullable + private Boolean allowCustomRouting; + /** * API name: {@code hidden} */ @@ -126,6 +146,14 @@ public final Builder hidden(@Nullable Boolean value) { return this; } + /** + * API name: {@code allow_custom_routing} + */ + public final Builder allowCustomRouting(@Nullable Boolean value) { + this.allowCustomRouting = value; + return this; + } + @Override protected Builder self() { return this; @@ -155,6 +183,7 @@ public DataStreamVisibility build() { protected static void setupDataStreamVisibilityDeserializer(ObjectDeserializer op) { op.add(Builder::hidden, JsonpDeserializer.booleanDeserializer(), "hidden"); + op.add(Builder::allowCustomRouting, JsonpDeserializer.booleanDeserializer(), "allow_custom_routing"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/RedactProcessor.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/RedactProcessor.java index 21a0fb763..6e132452f 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/RedactProcessor.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/RedactProcessor.java @@ -77,6 +77,9 @@ public class RedactProcessor extends ProcessorBase implements ProcessorVariant { @Nullable private final Boolean skipIfUnlicensed; + @Nullable + private final Boolean traceRedact; + // --------------------------------------------------------------------------------------------- private RedactProcessor(Builder builder) { @@ -89,6 +92,7 @@ private RedactProcessor(Builder builder) { this.suffix = builder.suffix; this.ignoreMissing = builder.ignoreMissing; this.skipIfUnlicensed = builder.skipIfUnlicensed; + this.traceRedact = builder.traceRedact; } @@ -172,6 +176,18 @@ public final Boolean skipIfUnlicensed() { return this.skipIfUnlicensed; } + /** + * If true then ingest metadata + * _ingest._redact._is_redacted is set to true if the + * document has been redacted + *

+ * API name: {@code trace_redact} + */ + @Nullable + public final Boolean traceRedact() { + return this.traceRedact; + } + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { super.serializeInternal(generator, mapper); @@ -219,6 +235,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.skipIfUnlicensed); } + if (this.traceRedact != null) { + generator.writeKey("trace_redact"); + generator.write(this.traceRedact); + + } } @@ -250,6 +271,9 @@ public static class Builder extends ProcessorBase.AbstractBuilder @Nullable private Boolean skipIfUnlicensed; + @Nullable + private Boolean traceRedact; + /** * Required - The field to be redacted *

@@ -347,6 +371,18 @@ public final Builder skipIfUnlicensed(@Nullable Boolean value) { return this; } + /** + * If true then ingest metadata + * _ingest._redact._is_redacted is set to true if the + * document has been redacted + *

+ * API name: {@code trace_redact} + */ + public final Builder traceRedact(@Nullable Boolean value) { + this.traceRedact = value; + return this; + } + @Override protected Builder self() { return this; @@ -384,6 +420,7 @@ protected static void setupRedactProcessorDeserializer(ObjectDeserializer> fn) { return fn.apply(new Builder()).build(); } + /** + * API name: {@code _redact} + */ + @Nullable + public final Redact redact() { + return this.redact; + } + /** * Required - API name: {@code timestamp} */ @@ -104,6 +116,11 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.redact != null) { + generator.writeKey("_redact"); + this.redact.serialize(generator, mapper); + + } generator.writeKey("timestamp"); this.timestamp.serialize(generator, mapper); if (this.pipeline != null) { @@ -126,11 +143,29 @@ public String toString() { */ public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + @Nullable + private Redact redact; + private DateTime timestamp; @Nullable private String pipeline; + /** + * API name: {@code _redact} + */ + public final Builder redact(@Nullable Redact value) { + this.redact = value; + return this; + } + + /** + * API name: {@code _redact} + */ + public final Builder redact(Function> fn) { + return this.redact(fn.apply(new Redact.Builder()).build()); + } + /** * Required - API name: {@code timestamp} */ @@ -175,6 +210,7 @@ public Ingest build() { protected static void setupIngestDeserializer(ObjectDeserializer op) { + op.add(Builder::redact, Redact._DESERIALIZER, "_redact"); op.add(Builder::timestamp, DateTime._DESERIALIZER, "timestamp"); op.add(Builder::pipeline, JsonpDeserializer.stringDeserializer(), "pipeline"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/simulate/Redact.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/simulate/Redact.java new file mode 100644 index 000000000..ceb041981 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/simulate/Redact.java @@ -0,0 +1,156 @@ +/* + * 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.simulate; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpUtils; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.WithJsonObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.Boolean; +import java.util.Objects; +import java.util.function.Function; + +//---------------------------------------------------------------- +// 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.simulate.Redact + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class Redact implements JsonpSerializable { + private final boolean isRedacted; + + // --------------------------------------------------------------------------------------------- + + private Redact(Builder builder) { + + this.isRedacted = ApiTypeHelper.requireNonNull(builder.isRedacted, this, "isRedacted"); + + } + + public static Redact of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - indicates if document has been redacted + *

+ * API name: {@code _is_redacted} + */ + public final boolean isRedacted() { + return this.isRedacted; + } + + /** + * 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("_is_redacted"); + generator.write(this.isRedacted); + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link Redact}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + private Boolean isRedacted; + + /** + * Required - indicates if document has been redacted + *

+ * API name: {@code _is_redacted} + */ + public final Builder isRedacted(boolean value) { + this.isRedacted = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link Redact}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public Redact build() { + _checkSingleUse(); + + return new Redact(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link Redact} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + Redact::setupRedactDeserializer); + + protected static void setupRedactDeserializer(ObjectDeserializer op) { + + op.add(Builder::isRedacted, JsonpDeserializer.booleanDeserializer(), "_is_redacted"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/info/Features.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/info/Features.java index 002902434..8e1562695 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/info/Features.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/info/Features.java @@ -64,22 +64,17 @@ public class Features implements JsonpSerializable { private final Feature ccr; - @Nullable - private final Feature dataFrame; - - @Nullable - private final Feature dataScience; - private final Feature dataStreams; private final Feature dataTiers; private final Feature enrich; + private final Feature enterpriseSearch; + private final Feature eql; - @Nullable - private final Feature flattened; + private final Feature esql; private final Feature frozenIndices; @@ -110,8 +105,7 @@ public class Features implements JsonpSerializable { private final Feature transform; - @Nullable - private final Feature vectors; + private final Feature universalProfiling; private final Feature votingOnly; @@ -126,13 +120,12 @@ private Features(Builder builder) { this.aggregateMetric = ApiTypeHelper.requireNonNull(builder.aggregateMetric, this, "aggregateMetric"); this.analytics = ApiTypeHelper.requireNonNull(builder.analytics, this, "analytics"); this.ccr = ApiTypeHelper.requireNonNull(builder.ccr, this, "ccr"); - this.dataFrame = builder.dataFrame; - this.dataScience = builder.dataScience; this.dataStreams = ApiTypeHelper.requireNonNull(builder.dataStreams, this, "dataStreams"); this.dataTiers = ApiTypeHelper.requireNonNull(builder.dataTiers, this, "dataTiers"); this.enrich = ApiTypeHelper.requireNonNull(builder.enrich, this, "enrich"); + this.enterpriseSearch = ApiTypeHelper.requireNonNull(builder.enterpriseSearch, this, "enterpriseSearch"); this.eql = ApiTypeHelper.requireNonNull(builder.eql, this, "eql"); - this.flattened = builder.flattened; + this.esql = ApiTypeHelper.requireNonNull(builder.esql, this, "esql"); this.frozenIndices = ApiTypeHelper.requireNonNull(builder.frozenIndices, this, "frozenIndices"); this.graph = ApiTypeHelper.requireNonNull(builder.graph, this, "graph"); this.ilm = ApiTypeHelper.requireNonNull(builder.ilm, this, "ilm"); @@ -148,7 +141,7 @@ private Features(Builder builder) { this.spatial = ApiTypeHelper.requireNonNull(builder.spatial, this, "spatial"); this.sql = ApiTypeHelper.requireNonNull(builder.sql, this, "sql"); this.transform = ApiTypeHelper.requireNonNull(builder.transform, this, "transform"); - this.vectors = builder.vectors; + this.universalProfiling = ApiTypeHelper.requireNonNull(builder.universalProfiling, this, "universalProfiling"); this.votingOnly = ApiTypeHelper.requireNonNull(builder.votingOnly, this, "votingOnly"); this.watcher = ApiTypeHelper.requireNonNull(builder.watcher, this, "watcher"); this.archive = ApiTypeHelper.requireNonNull(builder.archive, this, "archive"); @@ -180,22 +173,6 @@ public final Feature ccr() { return this.ccr; } - /** - * API name: {@code data_frame} - */ - @Nullable - public final Feature dataFrame() { - return this.dataFrame; - } - - /** - * API name: {@code data_science} - */ - @Nullable - public final Feature dataScience() { - return this.dataScience; - } - /** * Required - API name: {@code data_streams} */ @@ -217,6 +194,13 @@ public final Feature enrich() { return this.enrich; } + /** + * Required - API name: {@code enterprise_search} + */ + public final Feature enterpriseSearch() { + return this.enterpriseSearch; + } + /** * Required - API name: {@code eql} */ @@ -225,11 +209,10 @@ public final Feature eql() { } /** - * API name: {@code flattened} + * Required - API name: {@code esql} */ - @Nullable - public final Feature flattened() { - return this.flattened; + public final Feature esql() { + return this.esql; } /** @@ -332,11 +315,10 @@ public final Feature transform() { } /** - * API name: {@code vectors} + * Required - API name: {@code universal_profiling} */ - @Nullable - public final Feature vectors() { - return this.vectors; + public final Feature universalProfiling() { + return this.universalProfiling; } /** @@ -380,16 +362,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("ccr"); this.ccr.serialize(generator, mapper); - if (this.dataFrame != null) { - generator.writeKey("data_frame"); - this.dataFrame.serialize(generator, mapper); - - } - if (this.dataScience != null) { - generator.writeKey("data_science"); - this.dataScience.serialize(generator, mapper); - - } generator.writeKey("data_streams"); this.dataStreams.serialize(generator, mapper); @@ -399,14 +371,15 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("enrich"); this.enrich.serialize(generator, mapper); + generator.writeKey("enterprise_search"); + this.enterpriseSearch.serialize(generator, mapper); + generator.writeKey("eql"); this.eql.serialize(generator, mapper); - if (this.flattened != null) { - generator.writeKey("flattened"); - this.flattened.serialize(generator, mapper); + generator.writeKey("esql"); + this.esql.serialize(generator, mapper); - } generator.writeKey("frozen_indices"); this.frozenIndices.serialize(generator, mapper); @@ -451,11 +424,9 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("transform"); this.transform.serialize(generator, mapper); - if (this.vectors != null) { - generator.writeKey("vectors"); - this.vectors.serialize(generator, mapper); + generator.writeKey("universal_profiling"); + this.universalProfiling.serialize(generator, mapper); - } generator.writeKey("voting_only"); this.votingOnly.serialize(generator, mapper); @@ -485,22 +456,17 @@ public static class Builder extends WithJsonObjectBuilderBase implement private Feature ccr; - @Nullable - private Feature dataFrame; - - @Nullable - private Feature dataScience; - private Feature dataStreams; private Feature dataTiers; private Feature enrich; + private Feature enterpriseSearch; + private Feature eql; - @Nullable - private Feature flattened; + private Feature esql; private Feature frozenIndices; @@ -531,8 +497,7 @@ public static class Builder extends WithJsonObjectBuilderBase implement private Feature transform; - @Nullable - private Feature vectors; + private Feature universalProfiling; private Feature votingOnly; @@ -585,36 +550,6 @@ public final Builder ccr(Function> fn) { return this.ccr(fn.apply(new Feature.Builder()).build()); } - /** - * API name: {@code data_frame} - */ - public final Builder dataFrame(@Nullable Feature value) { - this.dataFrame = value; - return this; - } - - /** - * API name: {@code data_frame} - */ - public final Builder dataFrame(Function> fn) { - return this.dataFrame(fn.apply(new Feature.Builder()).build()); - } - - /** - * API name: {@code data_science} - */ - public final Builder dataScience(@Nullable Feature value) { - this.dataScience = value; - return this; - } - - /** - * API name: {@code data_science} - */ - public final Builder dataScience(Function> fn) { - return this.dataScience(fn.apply(new Feature.Builder()).build()); - } - /** * Required - API name: {@code data_streams} */ @@ -660,6 +595,21 @@ public final Builder enrich(Function> fn return this.enrich(fn.apply(new Feature.Builder()).build()); } + /** + * Required - API name: {@code enterprise_search} + */ + public final Builder enterpriseSearch(Feature value) { + this.enterpriseSearch = value; + return this; + } + + /** + * Required - API name: {@code enterprise_search} + */ + public final Builder enterpriseSearch(Function> fn) { + return this.enterpriseSearch(fn.apply(new Feature.Builder()).build()); + } + /** * Required - API name: {@code eql} */ @@ -676,18 +626,18 @@ public final Builder eql(Function> fn) { } /** - * API name: {@code flattened} + * Required - API name: {@code esql} */ - public final Builder flattened(@Nullable Feature value) { - this.flattened = value; + public final Builder esql(Feature value) { + this.esql = value; return this; } /** - * API name: {@code flattened} + * Required - API name: {@code esql} */ - public final Builder flattened(Function> fn) { - return this.flattened(fn.apply(new Feature.Builder()).build()); + public final Builder esql(Function> fn) { + return this.esql(fn.apply(new Feature.Builder()).build()); } /** @@ -901,18 +851,18 @@ public final Builder transform(Function> } /** - * API name: {@code vectors} + * Required - API name: {@code universal_profiling} */ - public final Builder vectors(@Nullable Feature value) { - this.vectors = value; + public final Builder universalProfiling(Feature value) { + this.universalProfiling = value; return this; } /** - * API name: {@code vectors} + * Required - API name: {@code universal_profiling} */ - public final Builder vectors(Function> fn) { - return this.vectors(fn.apply(new Feature.Builder()).build()); + public final Builder universalProfiling(Function> fn) { + return this.universalProfiling(fn.apply(new Feature.Builder()).build()); } /** @@ -991,13 +941,12 @@ protected static void setupFeaturesDeserializer(ObjectDeserializer