From 084ed704b4b44d6b61b6eae9ff9d7cbf422bf20e Mon Sep 17 00:00:00 2001 From: Florian Bernd Date: Mon, 3 Nov 2025 11:10:30 +0100 Subject: [PATCH 1/2] Fix deserialization of `SqlRow` values (#8767) --- .../Api/Sql/GetAsyncResponse.Converters.g.cs | 11 ++++++- .../_Generated/Api/Sql/GetAsyncResponse.g.cs | 13 +++++++- .../Api/Sql/QueryResponse.Converters.g.cs | 11 ++++++- .../_Generated/Api/Sql/QueryResponse.g.cs | 13 +++++++- .../_Shared/Api/Sql/GetAsyncResponse.cs | 15 --------- .../_Shared/Api/Sql/QueryResponse.cs | 15 --------- .../_Shared/Core/LazyJson.cs | 18 ++++++----- .../_Shared/Core/LazyJsonConverter.cs | 31 +++++++++---------- .../_Shared/Types/Sql/SqlRowConverter.cs | 20 ++---------- 9 files changed, 72 insertions(+), 75 deletions(-) delete mode 100644 src/Elastic.Clients.Elasticsearch/_Shared/Api/Sql/GetAsyncResponse.cs delete mode 100644 src/Elastic.Clients.Elasticsearch/_Shared/Api/Sql/QueryResponse.cs diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/GetAsyncResponse.Converters.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/GetAsyncResponse.Converters.g.cs index f0b1af35415..b3705829e6d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/GetAsyncResponse.Converters.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/GetAsyncResponse.Converters.g.cs @@ -30,6 +30,7 @@ public sealed partial class GetAsyncResponseConverter : System.Text.Json.Seriali private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); private static readonly System.Text.Json.JsonEncodedText PropIsPartial = System.Text.Json.JsonEncodedText.Encode("is_partial"); private static readonly System.Text.Json.JsonEncodedText PropIsRunning = System.Text.Json.JsonEncodedText.Encode("is_running"); + private static readonly System.Text.Json.JsonEncodedText PropRows = System.Text.Json.JsonEncodedText.Encode("rows"); public override Elastic.Clients.Elasticsearch.Sql.GetAsyncResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { @@ -39,6 +40,7 @@ public override Elastic.Clients.Elasticsearch.Sql.GetAsyncResponse Read(ref Syst LocalJsonValue propId = default; LocalJsonValue propIsPartial = default; LocalJsonValue propIsRunning = default; + LocalJsonValue> propRows = default; while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { if (propColumns.TryReadProperty(ref reader, options, PropColumns, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) @@ -66,6 +68,11 @@ public override Elastic.Clients.Elasticsearch.Sql.GetAsyncResponse Read(ref Syst continue; } + if (propRows.TryReadProperty(ref reader, options, PropRows, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) { reader.SafeSkip(); @@ -82,7 +89,8 @@ public override Elastic.Clients.Elasticsearch.Sql.GetAsyncResponse Read(ref Syst Cursor = propCursor.Value, Id = propId.Value, IsPartial = propIsPartial.Value, - IsRunning = propIsRunning.Value + IsRunning = propIsRunning.Value, + Rows = propRows.Value }; } @@ -94,6 +102,7 @@ public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clien writer.WriteProperty(options, PropId, value.Id, null, null); writer.WriteProperty(options, PropIsPartial, value.IsPartial, null, null); writer.WriteProperty(options, PropIsRunning, value.IsRunning, null, null); + writer.WriteProperty(options, PropRows, value.Rows, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); writer.WriteEndObject(); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/GetAsyncResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/GetAsyncResponse.g.cs index a37b797e8ce..833159e0b75 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/GetAsyncResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/GetAsyncResponse.g.cs @@ -24,7 +24,7 @@ namespace Elastic.Clients.Elasticsearch.Sql; [System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Sql.Json.GetAsyncResponseConverter))] -public partial class GetAsyncResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +public sealed partial class GetAsyncResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public GetAsyncResponse() @@ -93,4 +93,15 @@ internal GetAsyncResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstr required #endif bool IsRunning { get; set; } + + /// + /// + /// The values for the search results. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Rows { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/QueryResponse.Converters.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/QueryResponse.Converters.g.cs index 28090fdd3da..17bda1c4f4d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/QueryResponse.Converters.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/QueryResponse.Converters.g.cs @@ -30,6 +30,7 @@ public sealed partial class QueryResponseConverter : System.Text.Json.Serializat private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); private static readonly System.Text.Json.JsonEncodedText PropIsPartial = System.Text.Json.JsonEncodedText.Encode("is_partial"); private static readonly System.Text.Json.JsonEncodedText PropIsRunning = System.Text.Json.JsonEncodedText.Encode("is_running"); + private static readonly System.Text.Json.JsonEncodedText PropRows = System.Text.Json.JsonEncodedText.Encode("rows"); public override Elastic.Clients.Elasticsearch.Sql.QueryResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { @@ -39,6 +40,7 @@ public override Elastic.Clients.Elasticsearch.Sql.QueryResponse Read(ref System. LocalJsonValue propId = default; LocalJsonValue propIsPartial = default; LocalJsonValue propIsRunning = default; + LocalJsonValue> propRows = default; while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { if (propColumns.TryReadProperty(ref reader, options, PropColumns, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) @@ -66,6 +68,11 @@ public override Elastic.Clients.Elasticsearch.Sql.QueryResponse Read(ref System. continue; } + if (propRows.TryReadProperty(ref reader, options, PropRows, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) { reader.SafeSkip(); @@ -82,7 +89,8 @@ public override Elastic.Clients.Elasticsearch.Sql.QueryResponse Read(ref System. Cursor = propCursor.Value, Id = propId.Value, IsPartial = propIsPartial.Value, - IsRunning = propIsRunning.Value + IsRunning = propIsRunning.Value, + Rows = propRows.Value }; } @@ -94,6 +102,7 @@ public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clien writer.WriteProperty(options, PropId, value.Id, null, null); writer.WriteProperty(options, PropIsPartial, value.IsPartial, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, bool? v) => w.WriteNullableValue(o, v)); writer.WriteProperty(options, PropIsRunning, value.IsRunning, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, bool? v) => w.WriteNullableValue(o, v)); + writer.WriteProperty(options, PropRows, value.Rows, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); writer.WriteEndObject(); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/QueryResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/QueryResponse.g.cs index 114d6089418..058ee5cd0d8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/QueryResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/QueryResponse.g.cs @@ -24,7 +24,7 @@ namespace Elastic.Clients.Elasticsearch.Sql; [System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Sql.Json.QueryResponseConverter))] -public partial class QueryResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +public sealed partial class QueryResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public QueryResponse() @@ -81,4 +81,15 @@ internal QueryResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstruct /// /// public bool? IsRunning { get; set; } + + /// + /// + /// The values for the search results. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Rows { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Api/Sql/GetAsyncResponse.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Api/Sql/GetAsyncResponse.cs deleted file mode 100644 index 0ef4200ceb6..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Api/Sql/GetAsyncResponse.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System.Collections.Generic; -using System.Text.Json.Serialization; - -namespace Elastic.Clients.Elasticsearch.Sql; - -public partial class GetAsyncResponse -{ - [JsonInclude] - [JsonPropertyName("rows")] - public IReadOnlyCollection Rows { get; init; } -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Api/Sql/QueryResponse.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Api/Sql/QueryResponse.cs deleted file mode 100644 index b8b0f77dbc3..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Api/Sql/QueryResponse.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System.Collections.Generic; -using System.Text.Json.Serialization; - -namespace Elastic.Clients.Elasticsearch.Sql; - -public partial class QueryResponse -{ - [JsonInclude] - [JsonPropertyName("rows")] - public IReadOnlyCollection Rows { get; init; } -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/LazyJson.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/LazyJson.cs index 6554e86f3a7..dd3df743180 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/LazyJson.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Core/LazyJson.cs @@ -3,8 +3,11 @@ // See the LICENSE file in the project root for more information. using System; +using System.Text.Json; using System.Text.Json.Serialization; +using Elastic.Transport.Extensions; + namespace Elastic.Clients.Elasticsearch; /// @@ -14,13 +17,13 @@ namespace Elastic.Clients.Elasticsearch; [JsonConverter(typeof(Json.LazyJsonConverter))] public readonly struct LazyJson { - internal LazyJson(byte[] bytes, IElasticsearchClientSettings settings) + internal LazyJson(JsonElement json, IElasticsearchClientSettings? settings) { - Bytes = bytes; + Json = json; Settings = settings; } - internal byte[]? Bytes { get; } + internal JsonElement Json { get; } internal IElasticsearchClientSettings? Settings { get; } /// @@ -30,10 +33,11 @@ internal LazyJson(byte[] bytes, IElasticsearchClientSettings settings) /// The type public T? As() { - if (Bytes is null || Settings is null || Bytes.Length == 0) - return default; + if (Settings is null) + { + throw new InvalidOperationException($"Can not deserialize value without '{nameof(Settings)}'."); + } - using var ms = Settings.MemoryStreamFactory.Create(Bytes); - return Settings.SourceSerializer.Deserialize(ms); + return Settings.SourceSerializer.Deserialize(Json); } } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/LazyJsonConverter.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/LazyJsonConverter.cs index d14d41919ab..5291695a874 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/LazyJsonConverter.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Core/LazyJsonConverter.cs @@ -12,35 +12,32 @@ namespace Elastic.Clients.Elasticsearch.Json; public sealed class LazyJsonConverter : JsonConverter { - private IElasticsearchClientSettings _settings; + private IElasticsearchClientSettings? _settings; public override LazyJson Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { InitializeSettings(options); - // TODO: fixme -#pragma warning disable IL2026, IL3050 - using var jsonDoc = JsonSerializer.Deserialize(ref reader); +#pragma warning disable IL2026, IL3050 // The `TypeInfoResolver` for `RequestResponseConverter` knows how to handle `JsonElement`. + return new LazyJson(JsonSerializer.Deserialize(ref reader, options), _settings!); #pragma warning restore IL2026, IL3050 - using var stream = _settings.MemoryStreamFactory.Create(); - - var writer = new Utf8JsonWriter(stream); - jsonDoc.WriteTo(writer); - writer.Flush(); - - return new LazyJson(stream.ToArray(), _settings); } - public override void Write(Utf8JsonWriter writer, LazyJson value, JsonSerializerOptions options) => throw new NotImplementedException("We only ever expect to deserialize LazyJson on responses."); - private void InitializeSettings(JsonSerializerOptions options) { - if (_settings is null) + if (_settings is not null) { - if (!options.TryGetClientSettings(out var settings)) - ThrowHelper.ThrowJsonExceptionForMissingSettings(); + return; + } - _settings = settings; + if (!ContextProvider.TryGetContext(options, out _settings)) + { + ThrowHelper.ThrowJsonExceptionForMissingSettings(); } } + + public override void Write(Utf8JsonWriter writer, LazyJson value, JsonSerializerOptions options) + { + throw new NotImplementedException("We only ever expect to deserialize LazyJson on responses."); + } } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Sql/SqlRowConverter.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Sql/SqlRowConverter.cs index 46b39a310ed..67edbcd2efe 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Sql/SqlRowConverter.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Sql/SqlRowConverter.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System; -using System.Collections.Generic; using System.Text.Json; using System.Text.Json.Serialization; @@ -15,26 +14,13 @@ public sealed class SqlRowConverter : JsonConverter { public override SqlRow? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { - if (reader.TokenType == JsonTokenType.Null) + var values = reader.ReadCollectionValue(options, null); + if (values is null) { - reader.Read(); return null; } - if (reader.TokenType == JsonTokenType.StartArray) - { - var values = new List(); - - while (reader.Read() && reader.TokenType != JsonTokenType.EndArray) - { - var value = reader.ReadValue(options); - values.Add(value); - } - - return new SqlRow(values); - } - - throw new JsonException($"Unexpected JSON token when deserializing {nameof(SqlRow)}."); + return new SqlRow(values); } public override void Write(Utf8JsonWriter writer, SqlRow value, JsonSerializerOptions options) => throw new NotImplementedException(); From 6bb513a69d82d0f7a99cf72b26b0f94c809e3601 Mon Sep 17 00:00:00 2001 From: Florian Bernd Date: Mon, 3 Nov 2025 11:41:52 +0100 Subject: [PATCH 2/2] Regenerate client (#8772) --- .../IndexManagement/DownsampleRequest.g.cs | 57 +++++++++++-- .../PutDataLifecycleRequest.Converters.g.cs | 6 +- .../PutDataLifecycleRequest.g.cs | 25 +++++- .../Api/Inference/CompletionRequest.g.cs | 4 +- .../Api/Inference/DeleteInferenceRequest.g.cs | 6 +- .../Api/Inference/PutAnthropicRequest.g.cs | 6 +- .../Inference/PutAzureaistudioRequest.g.cs | 6 +- .../Api/Inference/SparseEmbeddingRequest.g.cs | 4 +- .../Inference/StreamCompletionRequest.g.cs | 4 +- .../Api/Inference/TextEmbeddingRequest.g.cs | 4 +- .../Api/Security/QueryRoleRequest.g.cs | 24 ++++-- .../GeoLineAggregation.Converters.g.cs | 2 +- .../Aggregations/GeoLineAggregation.g.cs | 13 +-- .../PercentilesAggregation.Converters.g.cs | 4 +- .../NodeAllocationExplanation.Converters.g.cs | 12 +-- .../Cluster/NodeAllocationExplanation.g.cs | 16 +--- .../DownsampleConfig.Converters.g.cs | 11 ++- .../IndexManagement/DownsampleConfig.g.cs | 18 +++++ .../DownsamplingRound.Converters.g.cs | 10 +-- .../IndexManagement/DownsamplingRound.g.cs | 25 ++---- .../SamplingMethod.Converters.g.cs | 81 +++++++++++++++++++ .../Types/IndexManagement/SamplingMethod.g.cs | 33 ++++++++ .../Inference/RequestChatCompletion.g.cs | 4 +- .../Types/RRFRetriever.Converters.g.cs | 6 +- .../_Generated/Types/RRFRetriever.g.cs | 73 +++-------------- .../RRFRetrieverComponent.Converters.g.cs | 72 +++++++++++++++++ .../Types/RRFRetrieverComponent.g.cs | 73 +++++++++++++++++ 27 files changed, 439 insertions(+), 160 deletions(-) create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SamplingMethod.Converters.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SamplingMethod.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/RRFRetrieverComponent.Converters.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/RRFRetrieverComponent.g.cs diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DownsampleRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DownsampleRequest.g.cs index f5d1361a812..ecad8e662e5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DownsampleRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DownsampleRequest.g.cs @@ -30,14 +30,29 @@ public sealed partial class DownsampleRequestParameters : Elastic.Transport.Requ /// /// /// Downsample an index. -/// Aggregate a time series (TSDS) index and store pre-computed statistical summaries (min, max, sum, value_count and avg) for each metric field grouped by a configured time interval. +/// Downsamples a time series (TSDS) index and reduces its size by keeping the last value or by pre-aggregating metrics: +/// +/// +/// +/// +/// When running in aggregate mode, it pre-calculates and stores statistical summaries (min, max, sum, value_count and avg) +/// for each metric field grouped by a configured time interval and their dimensions. +/// +/// +/// +/// +/// When running in last_value mode, it keeps the last value for each metric in the configured interval and their dimensions. +/// +/// +/// +/// /// For example, a TSDS index that contains metrics sampled every 10 seconds can be downsampled to an hourly index. /// All documents within an hour interval are summarized and stored as a single document in the downsample index. /// /// /// NOTE: Only indices in a time series data stream are supported. /// Neither field nor document level security can be defined on the source index. -/// The source index must be read only (index.blocks.write: true). +/// The source index must be read-only (index.blocks.write: true). /// /// [System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.Json.DownsampleRequestConverter))] @@ -104,14 +119,29 @@ internal DownsampleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConst /// /// /// Downsample an index. -/// Aggregate a time series (TSDS) index and store pre-computed statistical summaries (min, max, sum, value_count and avg) for each metric field grouped by a configured time interval. +/// Downsamples a time series (TSDS) index and reduces its size by keeping the last value or by pre-aggregating metrics: +/// +/// +/// +/// +/// When running in aggregate mode, it pre-calculates and stores statistical summaries (min, max, sum, value_count and avg) +/// for each metric field grouped by a configured time interval and their dimensions. +/// +/// +/// +/// +/// When running in last_value mode, it keeps the last value for each metric in the configured interval and their dimensions. +/// +/// +/// +/// /// For example, a TSDS index that contains metrics sampled every 10 seconds can be downsampled to an hourly index. /// All documents within an hour interval are summarized and stored as a single document in the downsample index. /// /// /// NOTE: Only indices in a time series data stream are supported. /// Neither field nor document level security can be defined on the source index. -/// The source index must be read only (index.blocks.write: true). +/// The source index must be read-only (index.blocks.write: true). /// /// public readonly partial struct DownsampleRequestDescriptor @@ -228,14 +258,29 @@ public Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequestDescriptor /// /// /// Downsample an index. -/// Aggregate a time series (TSDS) index and store pre-computed statistical summaries (min, max, sum, value_count and avg) for each metric field grouped by a configured time interval. +/// Downsamples a time series (TSDS) index and reduces its size by keeping the last value or by pre-aggregating metrics: +/// +/// +/// +/// +/// When running in aggregate mode, it pre-calculates and stores statistical summaries (min, max, sum, value_count and avg) +/// for each metric field grouped by a configured time interval and their dimensions. +/// +/// +/// +/// +/// When running in last_value mode, it keeps the last value for each metric in the configured interval and their dimensions. +/// +/// +/// +/// /// For example, a TSDS index that contains metrics sampled every 10 seconds can be downsampled to an hourly index. /// All documents within an hour interval are summarized and stored as a single document in the downsample index. /// /// /// NOTE: Only indices in a time series data stream are supported. /// Neither field nor document level security can be defined on the source index. -/// The source index must be read only (index.blocks.write: true). +/// The source index must be read-only (index.blocks.write: true). /// /// public readonly partial struct DownsampleRequestDescriptor diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutDataLifecycleRequest.Converters.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutDataLifecycleRequest.Converters.g.cs index 6c7ce0cc3d7..f4ce50aa4ab 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutDataLifecycleRequest.Converters.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutDataLifecycleRequest.Converters.g.cs @@ -33,7 +33,7 @@ public override Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleRe { reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); LocalJsonValue propDataRetention = default; - LocalJsonValue propDownsampling = default; + LocalJsonValue?> propDownsampling = default; LocalJsonValue propEnabled = default; while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { @@ -42,7 +42,7 @@ public override Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleRe continue; } - if (propDownsampling.TryReadProperty(ref reader, options, PropDownsampling, null)) + if (propDownsampling.TryReadProperty(ref reader, options, PropDownsampling, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) { continue; } @@ -74,7 +74,7 @@ public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clien { writer.WriteStartObject(); writer.WriteProperty(options, PropDataRetention, value.DataRetention, null, null); - writer.WriteProperty(options, PropDownsampling, value.Downsampling, null, null); + writer.WriteProperty(options, PropDownsampling, value.Downsampling, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); writer.WriteProperty(options, PropEnabled, value.Enabled, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, bool? v) => w.WriteNullableValue(o, v)); writer.WriteEndObject(); } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutDataLifecycleRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutDataLifecycleRequest.g.cs index 4f5e0da14ec..ded1340e63a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutDataLifecycleRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutDataLifecycleRequest.g.cs @@ -135,7 +135,7 @@ internal PutDataLifecycleRequest(Elastic.Clients.Elasticsearch.Serialization.Jso /// The downsampling configuration to execute for the managed backing index after rollover. /// /// - public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDownsampling? Downsampling { get; set; } + public System.Collections.Generic.ICollection? Downsampling { get; set; } /// /// @@ -256,7 +256,7 @@ public Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleRequestDesc /// The downsampling configuration to execute for the managed backing index after rollover. /// /// - public Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleRequestDescriptor Downsampling(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDownsampling? value) + public Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleRequestDescriptor Downsampling(System.Collections.Generic.ICollection? value) { Instance.Downsampling = value; return this; @@ -267,9 +267,26 @@ public Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleRequestDesc /// The downsampling configuration to execute for the managed backing index after rollover. /// /// - public Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleRequestDescriptor Downsampling(System.Action action) + public Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleRequestDescriptor Downsampling(params Elastic.Clients.Elasticsearch.IndexManagement.DownsamplingRound[] values) { - Instance.Downsampling = Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDownsamplingDescriptor.Build(action); + Instance.Downsampling = [.. values]; + return this; + } + + /// + /// + /// The downsampling configuration to execute for the managed backing index after rollover. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleRequestDescriptor Downsampling(params System.Action[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.IndexManagement.DownsamplingRoundDescriptor.Build(action)); + } + + Instance.Downsampling = items; return this; } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/CompletionRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/CompletionRequest.g.cs index 2ee3c2219c7..c4dbde46a14 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/CompletionRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/CompletionRequest.g.cs @@ -111,7 +111,7 @@ internal CompletionRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConst /// /// - /// Optional task settings + /// Task settings for the individual inference request. These settings are specific to the <task_type> you specified and override the task settings specified when initializing the service. /// /// public object? TaskSettings { get; set; } @@ -204,7 +204,7 @@ public Elastic.Clients.Elasticsearch.Inference.CompletionRequestDescriptor Input /// /// - /// Optional task settings + /// Task settings for the individual inference request. These settings are specific to the <task_type> you specified and override the task settings specified when initializing the service. /// /// public Elastic.Clients.Elasticsearch.Inference.CompletionRequestDescriptor TaskSettings(object? value) diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/DeleteInferenceRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/DeleteInferenceRequest.g.cs index 0a08d75c4fa..d17339c3aa5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/DeleteInferenceRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/DeleteInferenceRequest.g.cs @@ -27,7 +27,7 @@ public sealed partial class DeleteInferenceRequestParameters : Elastic.Transport { /// /// - /// When true, the endpoint is not deleted and a list of ingest processors which reference this endpoint is returned. + /// When true, checks the semantic_text fields and inference processors that reference the endpoint and returns them in a list, but does not delete the endpoint. /// /// public bool? DryRun { get => Q("dry_run"); set => Q("dry_run", value); } @@ -96,7 +96,7 @@ internal DeleteInferenceRequest(Elastic.Clients.Elasticsearch.Serialization.Json /// /// - /// When true, the endpoint is not deleted and a list of ingest processors which reference this endpoint is returned. + /// When true, checks the semantic_text fields and inference processors that reference the endpoint and returns them in a list, but does not delete the endpoint. /// /// public bool? DryRun { get => Q("dry_run"); set => Q("dry_run", value); } @@ -167,7 +167,7 @@ public Elastic.Clients.Elasticsearch.Inference.DeleteInferenceRequestDescriptor /// /// - /// When true, the endpoint is not deleted and a list of ingest processors which reference this endpoint is returned. + /// When true, checks the semantic_text fields and inference processors that reference the endpoint and returns them in a list, but does not delete the endpoint. /// /// public Elastic.Clients.Elasticsearch.Inference.DeleteInferenceRequestDescriptor DryRun(bool? value = true) diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutAnthropicRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutAnthropicRequest.g.cs index 04fae14c424..0658c9b7e9b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutAnthropicRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutAnthropicRequest.g.cs @@ -120,7 +120,7 @@ internal PutAnthropicRequest(Elastic.Clients.Elasticsearch.Serialization.JsonCon /// /// - /// Settings used to install the inference model. These settings are specific to the watsonxai service. + /// Settings used to install the inference model. These settings are specific to the anthropic service. /// /// public @@ -241,7 +241,7 @@ public Elastic.Clients.Elasticsearch.Inference.PutAnthropicRequestDescriptor Chu /// /// - /// Settings used to install the inference model. These settings are specific to the watsonxai service. + /// Settings used to install the inference model. These settings are specific to the anthropic service. /// /// public Elastic.Clients.Elasticsearch.Inference.PutAnthropicRequestDescriptor ServiceSettings(Elastic.Clients.Elasticsearch.Inference.AnthropicServiceSettings value) @@ -252,7 +252,7 @@ public Elastic.Clients.Elasticsearch.Inference.PutAnthropicRequestDescriptor Ser /// /// - /// Settings used to install the inference model. These settings are specific to the watsonxai service. + /// Settings used to install the inference model. These settings are specific to the anthropic service. /// /// public Elastic.Clients.Elasticsearch.Inference.PutAnthropicRequestDescriptor ServiceSettings(System.Action action) diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutAzureaistudioRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutAzureaistudioRequest.g.cs index 6f5cea295df..3ffc9d28eb1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutAzureaistudioRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutAzureaistudioRequest.g.cs @@ -119,7 +119,7 @@ internal PutAzureaistudioRequest(Elastic.Clients.Elasticsearch.Serialization.Jso /// /// - /// Settings used to install the inference model. These settings are specific to the openai service. + /// Settings used to install the inference model. These settings are specific to the azureaistudio service. /// /// public @@ -239,7 +239,7 @@ public Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioRequestDescriptor /// /// - /// Settings used to install the inference model. These settings are specific to the openai service. + /// Settings used to install the inference model. These settings are specific to the azureaistudio service. /// /// public Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioRequestDescriptor ServiceSettings(Elastic.Clients.Elasticsearch.Inference.AzureAiStudioServiceSettings value) @@ -250,7 +250,7 @@ public Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioRequestDescriptor /// /// - /// Settings used to install the inference model. These settings are specific to the openai service. + /// Settings used to install the inference model. These settings are specific to the azureaistudio service. /// /// public Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioRequestDescriptor ServiceSettings(System.Action action) diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/SparseEmbeddingRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/SparseEmbeddingRequest.g.cs index ee93b576c05..8f5cf155e3e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/SparseEmbeddingRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/SparseEmbeddingRequest.g.cs @@ -103,7 +103,7 @@ internal SparseEmbeddingRequest(Elastic.Clients.Elasticsearch.Serialization.Json /// /// - /// Optional task settings + /// Task settings for the individual inference request. These settings are specific to the <task_type> you specified and override the task settings specified when initializing the service. /// /// public object? TaskSettings { get; set; } @@ -188,7 +188,7 @@ public Elastic.Clients.Elasticsearch.Inference.SparseEmbeddingRequestDescriptor /// /// - /// Optional task settings + /// Task settings for the individual inference request. These settings are specific to the <task_type> you specified and override the task settings specified when initializing the service. /// /// public Elastic.Clients.Elasticsearch.Inference.SparseEmbeddingRequestDescriptor TaskSettings(object? value) diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/StreamCompletionRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/StreamCompletionRequest.g.cs index ee3061b3c53..3a7fd2941f1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/StreamCompletionRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/StreamCompletionRequest.g.cs @@ -114,7 +114,7 @@ internal StreamCompletionRequest(Elastic.Clients.Elasticsearch.Serialization.Jso /// /// - /// Optional task settings + /// Task settings for the individual inference request. These settings are specific to the <task_type> you specified and override the task settings specified when initializing the service. /// /// public object? TaskSettings { get; set; } @@ -213,7 +213,7 @@ public Elastic.Clients.Elasticsearch.Inference.StreamCompletionRequestDescriptor /// /// - /// Optional task settings + /// Task settings for the individual inference request. These settings are specific to the <task_type> you specified and override the task settings specified when initializing the service. /// /// public Elastic.Clients.Elasticsearch.Inference.StreamCompletionRequestDescriptor TaskSettings(object? value) diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/TextEmbeddingRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/TextEmbeddingRequest.g.cs index 7ed2cb2fc8f..50076b5db29 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/TextEmbeddingRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/TextEmbeddingRequest.g.cs @@ -138,7 +138,7 @@ internal TextEmbeddingRequest(Elastic.Clients.Elasticsearch.Serialization.JsonCo /// /// - /// Optional task settings + /// Task settings for the individual inference request. These settings are specific to the <task_type> you specified and override the task settings specified when initializing the service. /// /// public object? TaskSettings { get; set; } @@ -262,7 +262,7 @@ public Elastic.Clients.Elasticsearch.Inference.TextEmbeddingRequestDescriptor In /// /// - /// Optional task settings + /// Task settings for the individual inference request. These settings are specific to the <task_type> you specified and override the task settings specified when initializing the service. /// /// public Elastic.Clients.Elasticsearch.Inference.TextEmbeddingRequestDescriptor TaskSettings(object? value) diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/QueryRoleRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/QueryRoleRequest.g.cs index f8117558f63..0fae97c0318 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/QueryRoleRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/QueryRoleRequest.g.cs @@ -108,7 +108,8 @@ internal QueryRoleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstr /// /// /// The sort definition. - /// You can sort on username, roles, or enabled. + /// You can sort on name, description, metadata, applications.application, applications.privileges, + /// and applications.resources. /// In addition, sort can also be applied to the _doc field to sort by index order. /// /// @@ -246,7 +247,8 @@ public Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor Size(in /// /// /// The sort definition. - /// You can sort on username, roles, or enabled. + /// You can sort on name, description, metadata, applications.application, applications.privileges, + /// and applications.resources. /// In addition, sort can also be applied to the _doc field to sort by index order. /// /// @@ -259,7 +261,8 @@ public Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor Sort(Sy /// /// /// The sort definition. - /// You can sort on username, roles, or enabled. + /// You can sort on name, description, metadata, applications.application, applications.privileges, + /// and applications.resources. /// In addition, sort can also be applied to the _doc field to sort by index order. /// /// @@ -272,7 +275,8 @@ public Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor Sort(pa /// /// /// The sort definition. - /// You can sort on username, roles, or enabled. + /// You can sort on name, description, metadata, applications.application, applications.privileges, + /// and applications.resources. /// In addition, sort can also be applied to the _doc field to sort by index order. /// /// @@ -291,7 +295,8 @@ public Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor Sort(pa /// /// /// The sort definition. - /// You can sort on username, roles, or enabled. + /// You can sort on name, description, metadata, applications.application, applications.privileges, + /// and applications.resources. /// In addition, sort can also be applied to the _doc field to sort by index order. /// /// @@ -478,7 +483,8 @@ public Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor /// /// The sort definition. - /// You can sort on username, roles, or enabled. + /// You can sort on name, description, metadata, applications.application, applications.privileges, + /// and applications.resources. /// In addition, sort can also be applied to the _doc field to sort by index order. /// /// @@ -491,7 +497,8 @@ public Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor /// /// The sort definition. - /// You can sort on username, roles, or enabled. + /// You can sort on name, description, metadata, applications.application, applications.privileges, + /// and applications.resources. /// In addition, sort can also be applied to the _doc field to sort by index order. /// /// @@ -504,7 +511,8 @@ public Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor /// /// The sort definition. - /// You can sort on username, roles, or enabled. + /// You can sort on name, description, metadata, applications.application, applications.privileges, + /// and applications.resources. /// In addition, sort can also be applied to the _doc field to sort by index order. /// /// diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoLineAggregation.Converters.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoLineAggregation.Converters.g.cs index fc4c5d5770c..ed9cbccf6b3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoLineAggregation.Converters.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoLineAggregation.Converters.g.cs @@ -37,7 +37,7 @@ public override Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregation Re LocalJsonValue propIncludeSort = default; LocalJsonValue propPoint = default; LocalJsonValue propSize = default; - LocalJsonValue propSort = default; + LocalJsonValue propSort = default; LocalJsonValue propSortOrder = default; while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoLineAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoLineAggregation.g.cs index 49629d30757..944376f44ad 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoLineAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoLineAggregation.g.cs @@ -27,10 +27,9 @@ namespace Elastic.Clients.Elasticsearch.Aggregations; public sealed partial class GeoLineAggregation { [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] - public GeoLineAggregation(Elastic.Clients.Elasticsearch.Aggregations.GeoLinePoint point, Elastic.Clients.Elasticsearch.Aggregations.GeoLineSort sort) + public GeoLineAggregation(Elastic.Clients.Elasticsearch.Aggregations.GeoLinePoint point) { Point = point; - Sort = sort; } #if NET7_0_OR_GREATER public GeoLineAggregation() @@ -81,11 +80,7 @@ internal GeoLineAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonCons /// When the geo_line aggregation is nested inside a time_series aggregation, this field defaults to @timestamp, and any other value will result in error. /// /// - public -#if NET7_0_OR_GREATER - required -#endif - Elastic.Clients.Elasticsearch.Aggregations.GeoLineSort Sort { get; set; } + public Elastic.Clients.Elasticsearch.Aggregations.GeoLineSort? Sort { get; set; } /// /// @@ -165,7 +160,7 @@ public Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregationDescriptorgeo_line aggregation is nested inside a time_series aggregation, this field defaults to @timestamp, and any other value will result in error. /// /// - public Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregationDescriptor Sort(Elastic.Clients.Elasticsearch.Aggregations.GeoLineSort value) + public Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregationDescriptor Sort(Elastic.Clients.Elasticsearch.Aggregations.GeoLineSort? value) { Instance.Sort = value; return this; @@ -284,7 +279,7 @@ public Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregationDescriptor S /// When the geo_line aggregation is nested inside a time_series aggregation, this field defaults to @timestamp, and any other value will result in error. /// /// - public Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregationDescriptor Sort(Elastic.Clients.Elasticsearch.Aggregations.GeoLineSort value) + public Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregationDescriptor Sort(Elastic.Clients.Elasticsearch.Aggregations.GeoLineSort? value) { Instance.Sort = value; return this; diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/PercentilesAggregation.Converters.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/PercentilesAggregation.Converters.g.cs index 27d6eaf17cf..d34856d9be2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/PercentilesAggregation.Converters.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/PercentilesAggregation.Converters.g.cs @@ -72,7 +72,7 @@ public override Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregatio continue; } - if (propPercents.TryReadProperty(ref reader, options, PropPercents, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + if (propPercents.TryReadProperty(ref reader, options, PropPercents, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) { continue; } @@ -117,7 +117,7 @@ public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clien writer.WriteProperty(options, PropHdr, value.Hdr, null, null); writer.WriteProperty(options, PropKeyed, value.Keyed, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, bool? v) => w.WriteNullableValue(o, v)); writer.WriteProperty(options, PropMissing, value.Missing, null, null); - writer.WriteProperty(options, PropPercents, value.Percents, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropPercents, value.Percents, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); writer.WriteProperty(options, PropScript, value.Script, null, null); writer.WriteProperty(options, PropTDigest, value.TDigest, null, null); writer.WriteEndObject(); diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/NodeAllocationExplanation.Converters.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/NodeAllocationExplanation.Converters.g.cs index c3751b34710..a0c3659a901 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/NodeAllocationExplanation.Converters.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/NodeAllocationExplanation.Converters.g.cs @@ -38,7 +38,7 @@ public sealed partial class NodeAllocationExplanationConverter : System.Text.Jso public override Elastic.Clients.Elasticsearch.Cluster.NodeAllocationExplanation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); - LocalJsonValue> propDeciders = default; + LocalJsonValue?> propDeciders = default; LocalJsonValue> propNodeAttributes = default; LocalJsonValue propNodeDecision = default; LocalJsonValue propNodeId = default; @@ -46,10 +46,10 @@ public override Elastic.Clients.Elasticsearch.Cluster.NodeAllocationExplanation LocalJsonValue> propRoles = default; LocalJsonValue propStore = default; LocalJsonValue propTransportAddress = default; - LocalJsonValue propWeightRanking = default; + LocalJsonValue propWeightRanking = default; while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (propDeciders.TryReadProperty(ref reader, options, PropDeciders, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + if (propDeciders.TryReadProperty(ref reader, options, PropDeciders, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) { continue; } @@ -89,7 +89,7 @@ public override Elastic.Clients.Elasticsearch.Cluster.NodeAllocationExplanation continue; } - if (propWeightRanking.TryReadProperty(ref reader, options, PropWeightRanking, null)) + if (propWeightRanking.TryReadProperty(ref reader, options, PropWeightRanking, static int? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadNullableValue(o))) { continue; } @@ -121,7 +121,7 @@ public override Elastic.Clients.Elasticsearch.Cluster.NodeAllocationExplanation public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.NodeAllocationExplanation value, System.Text.Json.JsonSerializerOptions options) { writer.WriteStartObject(); - writer.WriteProperty(options, PropDeciders, value.Deciders, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropDeciders, value.Deciders, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); writer.WriteProperty(options, PropNodeAttributes, value.NodeAttributes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); writer.WriteProperty(options, PropNodeDecision, value.NodeDecision, null, null); writer.WriteProperty(options, PropNodeId, value.NodeId, null, null); @@ -129,7 +129,7 @@ public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clien writer.WriteProperty(options, PropRoles, value.Roles, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); writer.WriteProperty(options, PropStore, value.Store, null, null); writer.WriteProperty(options, PropTransportAddress, value.TransportAddress, null, null); - writer.WriteProperty(options, PropWeightRanking, value.WeightRanking, null, null); + writer.WriteProperty(options, PropWeightRanking, value.WeightRanking, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, int? v) => w.WriteNullableValue(o, v)); writer.WriteEndObject(); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/NodeAllocationExplanation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/NodeAllocationExplanation.g.cs index 2cf26319516..ebcb8852259 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/NodeAllocationExplanation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/NodeAllocationExplanation.g.cs @@ -27,16 +27,14 @@ namespace Elastic.Clients.Elasticsearch.Cluster; public sealed partial class NodeAllocationExplanation { [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] - public NodeAllocationExplanation(System.Collections.Generic.IReadOnlyCollection deciders, System.Collections.Generic.IReadOnlyDictionary nodeAttributes, Elastic.Clients.Elasticsearch.Cluster.Decision nodeDecision, string nodeId, string nodeName, System.Collections.Generic.IReadOnlyCollection roles, string transportAddress, int weightRanking) + public NodeAllocationExplanation(System.Collections.Generic.IReadOnlyDictionary nodeAttributes, Elastic.Clients.Elasticsearch.Cluster.Decision nodeDecision, string nodeId, string nodeName, System.Collections.Generic.IReadOnlyCollection roles, string transportAddress) { - Deciders = deciders; NodeAttributes = nodeAttributes; NodeDecision = nodeDecision; NodeId = nodeId; NodeName = nodeName; Roles = roles; TransportAddress = transportAddress; - WeightRanking = weightRanking; } #if NET7_0_OR_GREATER public NodeAllocationExplanation() @@ -55,11 +53,7 @@ internal NodeAllocationExplanation(Elastic.Clients.Elasticsearch.Serialization.J _ = sentinel; } - public -#if NET7_0_OR_GREATER - required -#endif - System.Collections.Generic.IReadOnlyCollection Deciders { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Deciders { get; set; } public #if NET7_0_OR_GREATER required @@ -91,9 +85,5 @@ internal NodeAllocationExplanation(Elastic.Clients.Elasticsearch.Serialization.J required #endif string TransportAddress { get; set; } - public -#if NET7_0_OR_GREATER - required -#endif - int WeightRanking { get; set; } + public int? WeightRanking { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DownsampleConfig.Converters.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DownsampleConfig.Converters.g.cs index 8e1ef2c4eed..0897a60e468 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DownsampleConfig.Converters.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DownsampleConfig.Converters.g.cs @@ -26,11 +26,13 @@ namespace Elastic.Clients.Elasticsearch.IndexManagement.Json; public sealed partial class DownsampleConfigConverter : System.Text.Json.Serialization.JsonConverter { private static readonly System.Text.Json.JsonEncodedText PropFixedInterval = System.Text.Json.JsonEncodedText.Encode("fixed_interval"); + private static readonly System.Text.Json.JsonEncodedText PropSamplingMethod = System.Text.Json.JsonEncodedText.Encode("sampling_method"); public override Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfig Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); LocalJsonValue propFixedInterval = default; + LocalJsonValue propSamplingMethod = default; while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { if (propFixedInterval.TryReadProperty(ref reader, options, PropFixedInterval, null)) @@ -38,6 +40,11 @@ public override Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfig R continue; } + if (propSamplingMethod.TryReadProperty(ref reader, options, PropSamplingMethod, static Elastic.Clients.Elasticsearch.IndexManagement.SamplingMethod? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadNullableValue(o))) + { + continue; + } + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) { reader.SafeSkip(); @@ -50,7 +57,8 @@ public override Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfig R reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); return new Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { - FixedInterval = propFixedInterval.Value + FixedInterval = propFixedInterval.Value, + SamplingMethod = propSamplingMethod.Value }; } @@ -58,6 +66,7 @@ public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clien { writer.WriteStartObject(); writer.WriteProperty(options, PropFixedInterval, value.FixedInterval, null, null); + writer.WriteProperty(options, PropSamplingMethod, value.SamplingMethod, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.IndexManagement.SamplingMethod? v) => w.WriteNullableValue(o, v)); writer.WriteEndObject(); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DownsampleConfig.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DownsampleConfig.g.cs index 80d06bc913d..fa5e15c2823 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DownsampleConfig.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DownsampleConfig.g.cs @@ -58,6 +58,13 @@ internal DownsampleConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstr required #endif string FixedInterval { get; set; } + + /// + /// + /// The sampling method used to reduce the documents; it can be either aggregate or last_value. Defaults to aggregate. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SamplingMethod? SamplingMethod { get; set; } } public readonly partial struct DownsampleConfigDescriptor @@ -90,6 +97,17 @@ public Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfigDescriptor return this; } + /// + /// + /// The sampling method used to reduce the documents; it can be either aggregate or last_value. Defaults to aggregate. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfigDescriptor SamplingMethod(Elastic.Clients.Elasticsearch.IndexManagement.SamplingMethod? value) + { + Instance.SamplingMethod = value; + return this; + } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] internal static Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfig Build(System.Action action) { diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DownsamplingRound.Converters.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DownsamplingRound.Converters.g.cs index 12fb8f801b2..b416644b831 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DownsamplingRound.Converters.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DownsamplingRound.Converters.g.cs @@ -26,13 +26,13 @@ namespace Elastic.Clients.Elasticsearch.IndexManagement.Json; public sealed partial class DownsamplingRoundConverter : System.Text.Json.Serialization.JsonConverter { private static readonly System.Text.Json.JsonEncodedText PropAfter = System.Text.Json.JsonEncodedText.Encode("after"); - private static readonly System.Text.Json.JsonEncodedText PropConfig = System.Text.Json.JsonEncodedText.Encode("config"); + private static readonly System.Text.Json.JsonEncodedText PropFixedInterval = System.Text.Json.JsonEncodedText.Encode("fixed_interval"); public override Elastic.Clients.Elasticsearch.IndexManagement.DownsamplingRound Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); LocalJsonValue propAfter = default; - LocalJsonValue propConfig = default; + LocalJsonValue propFixedInterval = default; while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { if (propAfter.TryReadProperty(ref reader, options, PropAfter, null)) @@ -40,7 +40,7 @@ public override Elastic.Clients.Elasticsearch.IndexManagement.DownsamplingRound continue; } - if (propConfig.TryReadProperty(ref reader, options, PropConfig, null)) + if (propFixedInterval.TryReadProperty(ref reader, options, PropFixedInterval, null)) { continue; } @@ -58,7 +58,7 @@ public override Elastic.Clients.Elasticsearch.IndexManagement.DownsamplingRound return new Elastic.Clients.Elasticsearch.IndexManagement.DownsamplingRound(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { After = propAfter.Value, - Config = propConfig.Value + FixedInterval = propFixedInterval.Value }; } @@ -66,7 +66,7 @@ public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clien { writer.WriteStartObject(); writer.WriteProperty(options, PropAfter, value.After, null, null); - writer.WriteProperty(options, PropConfig, value.Config, null, null); + writer.WriteProperty(options, PropFixedInterval, value.FixedInterval, null, null); writer.WriteEndObject(); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DownsamplingRound.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DownsamplingRound.g.cs index a56f7d5638e..7dd1ff0ccc1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DownsamplingRound.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DownsamplingRound.g.cs @@ -27,10 +27,10 @@ namespace Elastic.Clients.Elasticsearch.IndexManagement; public sealed partial class DownsamplingRound { [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] - public DownsamplingRound(Elastic.Clients.Elasticsearch.Duration after, Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfig config) + public DownsamplingRound(Elastic.Clients.Elasticsearch.Duration after, string fixedInterval) { After = after; - Config = config; + FixedInterval = fixedInterval; } #if NET7_0_OR_GREATER public DownsamplingRound() @@ -62,14 +62,14 @@ internal DownsamplingRound(Elastic.Clients.Elasticsearch.Serialization.JsonConst /// /// - /// The downsample configuration to execute. + /// The downsample interval. /// /// public #if NET7_0_OR_GREATER required #endif - Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfig Config { get; set; } + string FixedInterval { get; set; } } public readonly partial struct DownsamplingRoundDescriptor @@ -104,23 +104,12 @@ public Elastic.Clients.Elasticsearch.IndexManagement.DownsamplingRoundDescriptor /// /// - /// The downsample configuration to execute. + /// The downsample interval. /// /// - public Elastic.Clients.Elasticsearch.IndexManagement.DownsamplingRoundDescriptor Config(Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfig value) + public Elastic.Clients.Elasticsearch.IndexManagement.DownsamplingRoundDescriptor FixedInterval(string value) { - Instance.Config = value; - return this; - } - - /// - /// - /// The downsample configuration to execute. - /// - /// - public Elastic.Clients.Elasticsearch.IndexManagement.DownsamplingRoundDescriptor Config(System.Action action) - { - Instance.Config = Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfigDescriptor.Build(action); + Instance.FixedInterval = value; return this; } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SamplingMethod.Converters.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SamplingMethod.Converters.g.cs new file mode 100644 index 00000000000..56be5bb858f --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SamplingMethod.Converters.g.cs @@ -0,0 +1,81 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.IndexManagement.Json; + +public sealed partial class SamplingMethodConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberAggregate = System.Text.Json.JsonEncodedText.Encode("aggregate"); + private static readonly System.Text.Json.JsonEncodedText MemberLastValue = System.Text.Json.JsonEncodedText.Encode("last_value"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.SamplingMethod Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberAggregate)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.SamplingMethod.Aggregate; + } + + if (reader.ValueTextEquals(MemberLastValue)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.SamplingMethod.LastValue; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberAggregate.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.SamplingMethod.Aggregate; + } + + if (string.Equals(value, MemberLastValue.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.SamplingMethod.LastValue; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.IndexManagement.SamplingMethod)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.SamplingMethod value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.IndexManagement.SamplingMethod.Aggregate: + writer.WriteStringValue(MemberAggregate); + break; + case Elastic.Clients.Elasticsearch.IndexManagement.SamplingMethod.LastValue: + writer.WriteStringValue(MemberLastValue); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.IndexManagement.SamplingMethod)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.IndexManagement.SamplingMethod ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.SamplingMethod value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SamplingMethod.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SamplingMethod.g.cs new file mode 100644 index 00000000000..20193a64faf --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SamplingMethod.g.cs @@ -0,0 +1,33 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.IndexManagement; + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.Json.SamplingMethodConverter))] +public enum SamplingMethod +{ + [System.Runtime.Serialization.EnumMember(Value = "aggregate")] + Aggregate, + [System.Runtime.Serialization.EnumMember(Value = "last_value")] + LastValue +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/RequestChatCompletion.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/RequestChatCompletion.g.cs index f2e4fe76c94..de326c5f696 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/RequestChatCompletion.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/RequestChatCompletion.g.cs @@ -70,7 +70,7 @@ internal RequestChatCompletion(Elastic.Clients.Elasticsearch.Serialization.JsonC /// /// - /// The ID of the model to use. + /// The ID of the model to use. By default, the model ID is set to the value included when creating the inference endpoint. /// /// public string? Model { get; set; } @@ -225,7 +225,7 @@ public Elastic.Clients.Elasticsearch.Inference.RequestChatCompletionDescriptor M /// /// - /// The ID of the model to use. + /// The ID of the model to use. By default, the model ID is set to the value included when creating the inference endpoint. /// /// public Elastic.Clients.Elasticsearch.Inference.RequestChatCompletionDescriptor Model(string? value) diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/RRFRetriever.Converters.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/RRFRetriever.Converters.g.cs index 78c400d4365..0d754a4375f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/RRFRetriever.Converters.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/RRFRetriever.Converters.g.cs @@ -44,7 +44,7 @@ public override Elastic.Clients.Elasticsearch.RRFRetriever Read(ref System.Text. LocalJsonValue propQuery = default; LocalJsonValue propRankConstant = default; LocalJsonValue propRankWindowSize = default; - LocalJsonValue> propRetrievers = default; + LocalJsonValue>> propRetrievers = default; while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { if (propFields.TryReadProperty(ref reader, options, PropFields, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) @@ -82,7 +82,7 @@ public override Elastic.Clients.Elasticsearch.RRFRetriever Read(ref System.Text. continue; } - if (propRetrievers.TryReadProperty(ref reader, options, PropRetrievers, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + if (propRetrievers.TryReadProperty(ref reader, options, PropRetrievers, static System.Collections.Generic.ICollection> (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue>(o, static Elastic.Clients.Elasticsearch.Union (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadUnionValue(o, static (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => JsonUnionSelector.ByPropertyOfT2(ref r, o, "retriever"), null, null)!)!)) { continue; } @@ -120,7 +120,7 @@ public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clien writer.WriteProperty(options, PropQuery, value.Query, null, null); writer.WriteProperty(options, PropRankConstant, value.RankConstant, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, int? v) => w.WriteNullableValue(o, v)); writer.WriteProperty(options, PropRankWindowSize, value.RankWindowSize, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, int? v) => w.WriteNullableValue(o, v)); - writer.WriteProperty(options, PropRetrievers, value.Retrievers, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropRetrievers, value.Retrievers, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection> v) => w.WriteCollectionValue>(o, v, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Union v) => w.WriteUnionValue(o, v, null, null))); writer.WriteEndObject(); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/RRFRetriever.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/RRFRetriever.g.cs index 5b9285c9567..1525a1fc3f3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/RRFRetriever.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/RRFRetriever.g.cs @@ -27,7 +27,7 @@ namespace Elastic.Clients.Elasticsearch; public sealed partial class RRFRetriever { [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] - public RRFRetriever(System.Collections.Generic.ICollection retrievers) + public RRFRetriever(System.Collections.Generic.ICollection> retrievers) { Retrievers = retrievers; } @@ -88,14 +88,14 @@ internal RRFRetriever(Elastic.Clients.Elasticsearch.Serialization.JsonConstructo /// /// - /// A list of child retrievers to specify which sets of returned top documents will have the RRF formula applied to them. + /// A list of child retrievers to specify which sets of returned top documents will have the RRF formula applied to them. Each retriever can optionally include a weight parameter. /// /// public #if NET7_0_OR_GREATER required #endif - System.Collections.Generic.ICollection Retrievers { get; set; } + System.Collections.Generic.ICollection> Retrievers { get; set; } } public readonly partial struct RrfRetrieverDescriptor @@ -220,10 +220,10 @@ public Elastic.Clients.Elasticsearch.RrfRetrieverDescriptor RankWindo /// /// - /// A list of child retrievers to specify which sets of returned top documents will have the RRF formula applied to them. + /// A list of child retrievers to specify which sets of returned top documents will have the RRF formula applied to them. Each retriever can optionally include a weight parameter. /// /// - public Elastic.Clients.Elasticsearch.RrfRetrieverDescriptor Retrievers(System.Collections.Generic.ICollection value) + public Elastic.Clients.Elasticsearch.RrfRetrieverDescriptor Retrievers(System.Collections.Generic.ICollection> value) { Instance.Retrievers = value; return this; @@ -231,32 +231,15 @@ public Elastic.Clients.Elasticsearch.RrfRetrieverDescriptor Retriever /// /// - /// A list of child retrievers to specify which sets of returned top documents will have the RRF formula applied to them. + /// A list of child retrievers to specify which sets of returned top documents will have the RRF formula applied to them. Each retriever can optionally include a weight parameter. /// /// - public Elastic.Clients.Elasticsearch.RrfRetrieverDescriptor Retrievers(params Elastic.Clients.Elasticsearch.Retriever[] values) + public Elastic.Clients.Elasticsearch.RrfRetrieverDescriptor Retrievers(params Elastic.Clients.Elasticsearch.Union[] values) { Instance.Retrievers = [.. values]; return this; } - /// - /// - /// A list of child retrievers to specify which sets of returned top documents will have the RRF formula applied to them. - /// - /// - public Elastic.Clients.Elasticsearch.RrfRetrieverDescriptor Retrievers(params System.Action>[] actions) - { - var items = new System.Collections.Generic.List(); - foreach (var action in actions) - { - items.Add(Elastic.Clients.Elasticsearch.RetrieverDescriptor.Build(action)); - } - - Instance.Retrievers = items; - return this; - } - [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] internal static Elastic.Clients.Elasticsearch.RRFRetriever Build(System.Action> action) { @@ -405,10 +388,10 @@ public Elastic.Clients.Elasticsearch.RrfRetrieverDescriptor RankWindowSize(int? /// /// - /// A list of child retrievers to specify which sets of returned top documents will have the RRF formula applied to them. + /// A list of child retrievers to specify which sets of returned top documents will have the RRF formula applied to them. Each retriever can optionally include a weight parameter. /// /// - public Elastic.Clients.Elasticsearch.RrfRetrieverDescriptor Retrievers(System.Collections.Generic.ICollection value) + public Elastic.Clients.Elasticsearch.RrfRetrieverDescriptor Retrievers(System.Collections.Generic.ICollection> value) { Instance.Retrievers = value; return this; @@ -416,49 +399,15 @@ public Elastic.Clients.Elasticsearch.RrfRetrieverDescriptor Retrievers(System.Co /// /// - /// A list of child retrievers to specify which sets of returned top documents will have the RRF formula applied to them. + /// A list of child retrievers to specify which sets of returned top documents will have the RRF formula applied to them. Each retriever can optionally include a weight parameter. /// /// - public Elastic.Clients.Elasticsearch.RrfRetrieverDescriptor Retrievers(params Elastic.Clients.Elasticsearch.Retriever[] values) + public Elastic.Clients.Elasticsearch.RrfRetrieverDescriptor Retrievers(params Elastic.Clients.Elasticsearch.Union[] values) { Instance.Retrievers = [.. values]; return this; } - /// - /// - /// A list of child retrievers to specify which sets of returned top documents will have the RRF formula applied to them. - /// - /// - public Elastic.Clients.Elasticsearch.RrfRetrieverDescriptor Retrievers(params System.Action[] actions) - { - var items = new System.Collections.Generic.List(); - foreach (var action in actions) - { - items.Add(Elastic.Clients.Elasticsearch.RetrieverDescriptor.Build(action)); - } - - Instance.Retrievers = items; - return this; - } - - /// - /// - /// A list of child retrievers to specify which sets of returned top documents will have the RRF formula applied to them. - /// - /// - public Elastic.Clients.Elasticsearch.RrfRetrieverDescriptor Retrievers(params System.Action>[] actions) - { - var items = new System.Collections.Generic.List(); - foreach (var action in actions) - { - items.Add(Elastic.Clients.Elasticsearch.RetrieverDescriptor.Build(action)); - } - - Instance.Retrievers = items; - return this; - } - [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] internal static Elastic.Clients.Elasticsearch.RRFRetriever Build(System.Action action) { diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/RRFRetrieverComponent.Converters.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/RRFRetrieverComponent.Converters.g.cs new file mode 100644 index 00000000000..4cd7f9d7280 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/RRFRetrieverComponent.Converters.g.cs @@ -0,0 +1,72 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Json; + +public sealed partial class RRFRetrieverComponentConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropRetriever = System.Text.Json.JsonEncodedText.Encode("retriever"); + private static readonly System.Text.Json.JsonEncodedText PropWeight = System.Text.Json.JsonEncodedText.Encode("weight"); + + public override Elastic.Clients.Elasticsearch.RRFRetrieverComponent Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propRetriever = default; + LocalJsonValue propWeight = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propRetriever.TryReadProperty(ref reader, options, PropRetriever, null)) + { + continue; + } + + if (propWeight.TryReadProperty(ref reader, options, PropWeight, static float? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadNullableValue(o))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.SafeSkip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.RRFRetrieverComponent(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Retriever = propRetriever.Value, + Weight = propWeight.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.RRFRetrieverComponent value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropRetriever, value.Retriever, null, null); + writer.WriteProperty(options, PropWeight, value.Weight, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, float? v) => w.WriteNullableValue(o, v)); + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/RRFRetrieverComponent.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/RRFRetrieverComponent.g.cs new file mode 100644 index 00000000000..3c4b96d2ae7 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/RRFRetrieverComponent.g.cs @@ -0,0 +1,73 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch; + +/// +/// +/// Wraps a retriever with an optional weight for RRF scoring. +/// +/// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Json.RRFRetrieverComponentConverter))] +public sealed partial class RRFRetrieverComponent +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RRFRetrieverComponent(Elastic.Clients.Elasticsearch.Retriever retriever) + { + Retriever = retriever; + } +#if NET7_0_OR_GREATER + public RRFRetrieverComponent() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RRFRetrieverComponent() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RRFRetrieverComponent(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// The nested retriever configuration. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Retriever Retriever { get; set; } + + /// + /// + /// Weight multiplier for this retriever's contribution to the RRF score. Higher values increase influence. Defaults to 1.0 if not specified. Must be non-negative. + /// + /// + public float? Weight { get; set; } +} \ No newline at end of file