From 92bd13cb3b6effcd4bb43de74ba9eeff7d079fdf Mon Sep 17 00:00:00 2001 From: Steve Gordon Date: Wed, 29 Jun 2022 14:20:05 +0100 Subject: [PATCH] Responding to latest spec fixes (#6490) --- .../Common/Infer/Field/Field.cs | 21 +- .../Serialization/UnionConverter.cs | 28 +- .../Types/Aggregations/AggregateOrder.cs | 28 ++ .../Types/Aggregations/HistogramOrder.cs | 16 - .../Types/Aggregations/AggregateOrder.g.cs | 38 ++ .../DateHistogramAggregation.g.cs | 80 +--- .../Aggregations/HistogramAggregation.g.cs | 80 +--- .../Types/Aggregations/HistogramOrder.g.cs | 79 ---- .../Aggregations/MultiTermsAggregation.g.cs | 343 ++++++++++++++++++ .../Analysis/AsciiFoldingTokenFilter.g.cs | 14 +- .../Analysis/DelimitedPayloadTokenFilter.g.cs | 28 +- .../Types/Analysis/EdgeNGramTokenFilter.g.cs | 28 +- .../Types/Analysis/ElisionTokenFilter.g.cs | 48 ++- .../Analysis/FingerprintTokenFilter.g.cs | 28 +- .../Types/Analysis/HunspellTokenFilter.g.cs | 42 ++- .../Types/Analysis/LengthTokenFilter.g.cs | 28 +- .../Analysis/LimitTokenCountTokenFilter.g.cs | 28 +- .../Analysis/MultiplexerTokenFilter.g.cs | 14 +- .../Analysis/NoriPartOfSpeechTokenFilter.g.cs | 14 +- .../Analysis/PatternCaptureTokenFilter.g.cs | 14 +- .../Analysis/PatternReplaceTokenFilter.g.cs | 48 ++- .../Types/Analysis/StopTokenFilter.g.cs | 14 +- .../Types/Analysis/TruncateTokenFilter.g.cs | 14 +- .../Types/IndexManagement/IndexSettings.g.cs | 100 ++--- .../Types/Migration/MigrationFeature.g.cs | 12 + .../DateHistogramAggregationUsageTests.cs | 6 +- 26 files changed, 766 insertions(+), 427 deletions(-) create mode 100644 src/Elastic.Clients.Elasticsearch/Types/Aggregations/AggregateOrder.cs delete mode 100644 src/Elastic.Clients.Elasticsearch/Types/Aggregations/HistogramOrder.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AggregateOrder.g.cs delete mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/HistogramOrder.g.cs diff --git a/src/Elastic.Clients.Elasticsearch/Common/Infer/Field/Field.cs b/src/Elastic.Clients.Elasticsearch/Common/Infer/Field/Field.cs index 0896bb3e847..e302c62331e 100644 --- a/src/Elastic.Clients.Elasticsearch/Common/Infer/Field/Field.cs +++ b/src/Elastic.Clients.Elasticsearch/Common/Infer/Field/Field.cs @@ -14,7 +14,7 @@ namespace Elastic.Clients.Elasticsearch; [JsonConverter(typeof(FieldConverter))] [DebuggerDisplay("{" + nameof(DebugDisplay) + ",nq}")] -public sealed class Field : IEquatable, IUrlParameter +public sealed class Field : IEquatable, IUrlParameter, IDictionaryKey { private readonly object _comparisonValue; private readonly Type _type; @@ -95,15 +95,26 @@ public bool Equals(Field other) => _type != null ? other != null && _type == other._type && _comparisonValue.Equals(other._comparisonValue) : other != null && _comparisonValue.Equals(other._comparisonValue); - string IUrlParameter.GetString(ITransportConfiguration? settings) + string IUrlParameter.GetString(ITransportConfiguration settings) { - if (!(settings is IElasticsearchClientSettings ElasticsearchSettings)) + if (settings is not IElasticsearchClientSettings elasticsearchSettings) { throw new ArgumentNullException(nameof(settings), $"Can not resolve {nameof(Field)} if no {nameof(IElasticsearchClientSettings)} is provided"); } - return ElasticsearchSettings.Inferrer.Field(this); + return GetStringCore(elasticsearchSettings); + } + + private string GetStringCore(IElasticsearchClientSettings settings) + { + if (settings is null) + { + throw new ArgumentNullException(nameof(settings), + $"Can not resolve {nameof(Field)} if no {nameof(IElasticsearchClientSettings)} is provided"); + } + + return settings.Inferrer.Field(this); } public override string ToString() => DebugDisplay; @@ -172,6 +183,8 @@ public override bool Equals(object obj) } } + string IDictionaryKey.Key(IElasticsearchClientSettings settings) => GetStringCore(settings); + public static bool operator ==(Field x, Field y) => Equals(x, y); public static bool operator !=(Field x, Field y) => !Equals(x, y); diff --git a/src/Elastic.Clients.Elasticsearch/Serialization/UnionConverter.cs b/src/Elastic.Clients.Elasticsearch/Serialization/UnionConverter.cs index 3c594e2489b..3fe416f5296 100644 --- a/src/Elastic.Clients.Elasticsearch/Serialization/UnionConverter.cs +++ b/src/Elastic.Clients.Elasticsearch/Serialization/UnionConverter.cs @@ -61,6 +61,7 @@ public override JsonConverter CreateConverter( } private class DerivedUnionConverterInner : JsonConverter + where TType : Union { public override TType? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { @@ -72,7 +73,7 @@ private class DerivedUnionConverterInner : JsonConverter< { var itemOne = JsonSerializer.Deserialize(ref readerCopy, options); - if (itemOne is TItem1) + if (itemOne is not null) { reader = readerCopy; return (TType)Activator.CreateInstance(typeof(TType), itemOne); @@ -87,7 +88,7 @@ private class DerivedUnionConverterInner : JsonConverter< { var itemTwo = JsonSerializer.Deserialize(ref reader, options); - if (itemTwo is TItem2) + if (itemTwo is not null) { return (TType)Activator.CreateInstance(typeof(TType), itemTwo); } @@ -109,20 +110,19 @@ public override void Write(Utf8JsonWriter writer, TType value, return; } - //if (value.Item1 is not null) - //{ - // JsonSerializer.Serialize(writer, value.Item1, value.Item1.GetType(), options); - // return; - //} + if (value.Item1 is not null) + { + JsonSerializer.Serialize(writer, value.Item1, value.Item1.GetType(), options); + return; + } - //if (value.Item2 is not null) - //{ - // JsonSerializer.Serialize(writer, value.Item2, value.Item2.GetType(), options); - // return; - //} + if (value.Item2 is not null) + { + JsonSerializer.Serialize(writer, value.Item2, value.Item2.GetType(), options); + return; + } - throw new JsonException("TODO"); - //throw new JsonException("Invalid union type."); + throw new JsonException("Invalid union type."); } } diff --git a/src/Elastic.Clients.Elasticsearch/Types/Aggregations/AggregateOrder.cs b/src/Elastic.Clients.Elasticsearch/Types/Aggregations/AggregateOrder.cs new file mode 100644 index 00000000000..818a8fe8c5b --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/Types/Aggregations/AggregateOrder.cs @@ -0,0 +1,28 @@ +// 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. + +namespace Elastic.Clients.Elasticsearch.Aggregations; + +public partial class AggregateOrder +{ + public static AggregateOrder KeyDescending => new(new System.Collections.Generic.Dictionary + { + { "_key", SortOrder.Desc } + }); + + public static AggregateOrder KeyAscending => new(new System.Collections.Generic.Dictionary + { + { "_key", SortOrder.Asc } + }); + + public static AggregateOrder CountDescending => new(new System.Collections.Generic.Dictionary + { + { "_count", SortOrder.Desc } + }); + + public static AggregateOrder CountAscending => new(new System.Collections.Generic.Dictionary + { + { "_count", SortOrder.Asc } + }); +} diff --git a/src/Elastic.Clients.Elasticsearch/Types/Aggregations/HistogramOrder.cs b/src/Elastic.Clients.Elasticsearch/Types/Aggregations/HistogramOrder.cs deleted file mode 100644 index 0b2e172e4f8..00000000000 --- a/src/Elastic.Clients.Elasticsearch/Types/Aggregations/HistogramOrder.cs +++ /dev/null @@ -1,16 +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. - -namespace Elastic.Clients.Elasticsearch.Aggregations; - -public partial class HistogramOrder -{ - public static HistogramOrder KeyDescending => new() { Key = SortOrder.Desc }; - - public static HistogramOrder KeyAscending => new() { Key = SortOrder.Asc }; - - public static HistogramOrder CountDescending => new() { Count = SortOrder.Desc }; - - public static HistogramOrder CountAscending => new() { Count = SortOrder.Asc }; -} diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AggregateOrder.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AggregateOrder.g.cs new file mode 100644 index 00000000000..5c332dea816 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AggregateOrder.g.cs @@ -0,0 +1,38 @@ +// 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. +// +// ------------------------------------------------ + +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +#nullable restore +namespace Elastic.Clients.Elasticsearch.Aggregations +{ + public partial class AggregateOrder : Union?, IReadOnlyCollection>?> + { + public AggregateOrder(Dictionary? item) : base(item) + { + } + + public AggregateOrder(IReadOnlyCollection>? item) : base(item) + { + } + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DateHistogramAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DateHistogramAggregation.g.cs index 750f7d1aba7..6825c2d5019 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DateHistogramAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DateHistogramAggregation.g.cs @@ -118,7 +118,7 @@ public override DateHistogramAggregation Read(ref Utf8JsonReader reader, Type ty if (reader.ValueTextEquals("order")) { - var value = JsonSerializer.Deserialize(ref reader, options); + var value = JsonSerializer.Deserialize(ref reader, options); if (value is not null) { agg.Order = value; @@ -319,7 +319,7 @@ public DateHistogramAggregation(string name) : base(name) [JsonInclude] [JsonPropertyName("order")] - public Elastic.Clients.Elasticsearch.Aggregations.HistogramOrder? Order { get; set; } + public Elastic.Clients.Elasticsearch.Aggregations.AggregateOrder? Order { get; set; } [JsonInclude] [JsonPropertyName("params")] @@ -369,11 +369,7 @@ public DateHistogramAggregationDescriptor() : base() private Elastic.Clients.Elasticsearch.Duration? OffsetValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.HistogramOrder? OrderValue { get; set; } - - private HistogramOrderDescriptor OrderDescriptor { get; set; } - - private Action OrderDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.AggregateOrder? OrderValue { get; set; } private Dictionary? ParamsValue { get; set; } @@ -481,30 +477,12 @@ public DateHistogramAggregationDescriptor Offset(Elastic.Clients.Elas return Self; } - public DateHistogramAggregationDescriptor Order(Elastic.Clients.Elasticsearch.Aggregations.HistogramOrder? order) + public DateHistogramAggregationDescriptor Order(Elastic.Clients.Elasticsearch.Aggregations.AggregateOrder? order) { - OrderDescriptor = null; - OrderDescriptorAction = null; OrderValue = order; return Self; } - public DateHistogramAggregationDescriptor Order(HistogramOrderDescriptor descriptor) - { - OrderValue = null; - OrderDescriptorAction = null; - OrderDescriptor = descriptor; - return Self; - } - - public DateHistogramAggregationDescriptor Order(Action configure) - { - OrderValue = null; - OrderDescriptor = null; - OrderDescriptorAction = configure; - return Self; - } - public DateHistogramAggregationDescriptor Params(Func, FluentDictionary> selector) { ParamsValue = selector?.Invoke(new FluentDictionary()); @@ -580,17 +558,7 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o JsonSerializer.Serialize(writer, OffsetValue, options); } - if (OrderDescriptor is not null) - { - writer.WritePropertyName("order"); - JsonSerializer.Serialize(writer, OrderDescriptor, options); - } - else if (OrderDescriptorAction is not null) - { - writer.WritePropertyName("order"); - JsonSerializer.Serialize(writer, new HistogramOrderDescriptor(OrderDescriptorAction), options); - } - else if (OrderValue is not null) + if (OrderValue is not null) { writer.WritePropertyName("order"); JsonSerializer.Serialize(writer, OrderValue, options); @@ -670,11 +638,7 @@ public DateHistogramAggregationDescriptor() : base() private Elastic.Clients.Elasticsearch.Duration? OffsetValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.HistogramOrder? OrderValue { get; set; } - - private HistogramOrderDescriptor OrderDescriptor { get; set; } - - private Action OrderDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.AggregateOrder? OrderValue { get; set; } private Dictionary? ParamsValue { get; set; } @@ -788,30 +752,12 @@ public DateHistogramAggregationDescriptor Offset(Elastic.Clients.Elasticsearch.D return Self; } - public DateHistogramAggregationDescriptor Order(Elastic.Clients.Elasticsearch.Aggregations.HistogramOrder? order) + public DateHistogramAggregationDescriptor Order(Elastic.Clients.Elasticsearch.Aggregations.AggregateOrder? order) { - OrderDescriptor = null; - OrderDescriptorAction = null; OrderValue = order; return Self; } - public DateHistogramAggregationDescriptor Order(HistogramOrderDescriptor descriptor) - { - OrderValue = null; - OrderDescriptorAction = null; - OrderDescriptor = descriptor; - return Self; - } - - public DateHistogramAggregationDescriptor Order(Action configure) - { - OrderValue = null; - OrderDescriptor = null; - OrderDescriptorAction = configure; - return Self; - } - public DateHistogramAggregationDescriptor Params(Func, FluentDictionary> selector) { ParamsValue = selector?.Invoke(new FluentDictionary()); @@ -887,17 +833,7 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o JsonSerializer.Serialize(writer, OffsetValue, options); } - if (OrderDescriptor is not null) - { - writer.WritePropertyName("order"); - JsonSerializer.Serialize(writer, OrderDescriptor, options); - } - else if (OrderDescriptorAction is not null) - { - writer.WritePropertyName("order"); - JsonSerializer.Serialize(writer, new HistogramOrderDescriptor(OrderDescriptorAction), options); - } - else if (OrderValue is not null) + if (OrderValue is not null) { writer.WritePropertyName("order"); JsonSerializer.Serialize(writer, OrderValue, options); diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/HistogramAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/HistogramAggregation.g.cs index b92f7bbd1cf..ccfa3bb0157 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/HistogramAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/HistogramAggregation.g.cs @@ -107,7 +107,7 @@ public override HistogramAggregation Read(ref Utf8JsonReader reader, Type typeTo if (reader.ValueTextEquals("order")) { - var value = JsonSerializer.Deserialize(ref reader, options); + var value = JsonSerializer.Deserialize(ref reader, options); if (value is not null) { agg.Order = value; @@ -264,7 +264,7 @@ public HistogramAggregation(string name) : base(name) [JsonInclude] [JsonPropertyName("order")] - public Elastic.Clients.Elasticsearch.Aggregations.HistogramOrder? Order { get; set; } + public Elastic.Clients.Elasticsearch.Aggregations.AggregateOrder? Order { get; set; } [JsonInclude] [JsonPropertyName("script")] @@ -304,11 +304,7 @@ public HistogramAggregationDescriptor() : base() private double? OffsetValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.HistogramOrder? OrderValue { get; set; } - - private HistogramOrderDescriptor OrderDescriptor { get; set; } - - private Action OrderDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.AggregateOrder? OrderValue { get; set; } public HistogramAggregationDescriptor Aggregations(Elastic.Clients.Elasticsearch.Aggregations.AggregationDictionary? aggregations) { @@ -406,30 +402,12 @@ public HistogramAggregationDescriptor Offset(double? offset) return Self; } - public HistogramAggregationDescriptor Order(Elastic.Clients.Elasticsearch.Aggregations.HistogramOrder? order) + public HistogramAggregationDescriptor Order(Elastic.Clients.Elasticsearch.Aggregations.AggregateOrder? order) { - OrderDescriptor = null; - OrderDescriptorAction = null; OrderValue = order; return Self; } - public HistogramAggregationDescriptor Order(HistogramOrderDescriptor descriptor) - { - OrderValue = null; - OrderDescriptorAction = null; - OrderDescriptor = descriptor; - return Self; - } - - public HistogramAggregationDescriptor Order(Action configure) - { - OrderValue = null; - OrderDescriptor = null; - OrderDescriptorAction = configure; - return Self; - } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) { writer.WriteStartObject(); @@ -487,17 +465,7 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o writer.WriteNumberValue(OffsetValue.Value); } - if (OrderDescriptor is not null) - { - writer.WritePropertyName("order"); - JsonSerializer.Serialize(writer, OrderDescriptor, options); - } - else if (OrderDescriptorAction is not null) - { - writer.WritePropertyName("order"); - JsonSerializer.Serialize(writer, new HistogramOrderDescriptor(OrderDescriptorAction), options); - } - else if (OrderValue is not null) + if (OrderValue is not null) { writer.WritePropertyName("order"); JsonSerializer.Serialize(writer, OrderValue, options); @@ -563,11 +531,7 @@ public HistogramAggregationDescriptor() : base() private double? OffsetValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.HistogramOrder? OrderValue { get; set; } - - private HistogramOrderDescriptor OrderDescriptor { get; set; } - - private Action OrderDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.AggregateOrder? OrderValue { get; set; } public HistogramAggregationDescriptor Aggregations(Elastic.Clients.Elasticsearch.Aggregations.AggregationDictionary? aggregations) { @@ -671,30 +635,12 @@ public HistogramAggregationDescriptor Offset(double? offset) return Self; } - public HistogramAggregationDescriptor Order(Elastic.Clients.Elasticsearch.Aggregations.HistogramOrder? order) + public HistogramAggregationDescriptor Order(Elastic.Clients.Elasticsearch.Aggregations.AggregateOrder? order) { - OrderDescriptor = null; - OrderDescriptorAction = null; OrderValue = order; return Self; } - public HistogramAggregationDescriptor Order(HistogramOrderDescriptor descriptor) - { - OrderValue = null; - OrderDescriptorAction = null; - OrderDescriptor = descriptor; - return Self; - } - - public HistogramAggregationDescriptor Order(Action configure) - { - OrderValue = null; - OrderDescriptor = null; - OrderDescriptorAction = configure; - return Self; - } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) { writer.WriteStartObject(); @@ -752,17 +698,7 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o writer.WriteNumberValue(OffsetValue.Value); } - if (OrderDescriptor is not null) - { - writer.WritePropertyName("order"); - JsonSerializer.Serialize(writer, OrderDescriptor, options); - } - else if (OrderDescriptorAction is not null) - { - writer.WritePropertyName("order"); - JsonSerializer.Serialize(writer, new HistogramOrderDescriptor(OrderDescriptorAction), options); - } - else if (OrderValue is not null) + if (OrderValue is not null) { writer.WritePropertyName("order"); JsonSerializer.Serialize(writer, OrderValue, options); diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/HistogramOrder.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/HistogramOrder.g.cs deleted file mode 100644 index e878fcd405c..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/HistogramOrder.g.cs +++ /dev/null @@ -1,79 +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. -// -// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ -// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ -// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ -// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ -// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ -// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ -// ------------------------------------------------ -// -// This file is automatically generated. -// Please do not edit these files manually. -// -// ------------------------------------------------ - -using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; - -#nullable restore -namespace Elastic.Clients.Elasticsearch.Aggregations -{ - public partial class HistogramOrder - { - [JsonInclude] - [JsonPropertyName("_count")] - public Elastic.Clients.Elasticsearch.SortOrder? Count { get; set; } - - [JsonInclude] - [JsonPropertyName("_key")] - public Elastic.Clients.Elasticsearch.SortOrder? Key { get; set; } - } - - public sealed partial class HistogramOrderDescriptor : SerializableDescriptorBase - { - internal HistogramOrderDescriptor(Action configure) => configure.Invoke(this); - public HistogramOrderDescriptor() : base() - { - } - - private Elastic.Clients.Elasticsearch.SortOrder? CountValue { get; set; } - - private Elastic.Clients.Elasticsearch.SortOrder? KeyValue { get; set; } - - public HistogramOrderDescriptor Count(Elastic.Clients.Elasticsearch.SortOrder? count) - { - CountValue = count; - return Self; - } - - public HistogramOrderDescriptor Key(Elastic.Clients.Elasticsearch.SortOrder? key) - { - KeyValue = key; - return Self; - } - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - writer.WriteStartObject(); - if (CountValue is not null) - { - writer.WritePropertyName("_count"); - JsonSerializer.Serialize(writer, CountValue, options); - } - - if (KeyValue is not null) - { - writer.WritePropertyName("_key"); - JsonSerializer.Serialize(writer, KeyValue, options); - } - - writer.WriteEndObject(); - } - } -} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MultiTermsAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MultiTermsAggregation.g.cs index 7092be52d45..12fd7cba6a4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MultiTermsAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MultiTermsAggregation.g.cs @@ -39,6 +39,83 @@ public override MultiTermsAggregation Read(ref Utf8JsonReader reader, Type typeT { if (reader.TokenType == JsonTokenType.PropertyName) { + if (reader.ValueTextEquals("collect_mode")) + { + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.CollectMode = value; + } + + continue; + } + + if (reader.ValueTextEquals("min_doc_count")) + { + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.MinDocCount = value; + } + + continue; + } + + if (reader.ValueTextEquals("order")) + { + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.Order = value; + } + + continue; + } + + if (reader.ValueTextEquals("shard_min_doc_count")) + { + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.ShardMinDocCount = value; + } + + continue; + } + + if (reader.ValueTextEquals("shard_size")) + { + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.ShardSize = value; + } + + continue; + } + + if (reader.ValueTextEquals("show_term_doc_count_error")) + { + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.ShowTermDocCountError = value; + } + + continue; + } + + if (reader.ValueTextEquals("size")) + { + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.Size = value; + } + + continue; + } + if (reader.ValueTextEquals("terms")) { var value = JsonSerializer.Deserialize>(ref reader, options); @@ -89,6 +166,48 @@ public override void Write(Utf8JsonWriter writer, MultiTermsAggregation value, J writer.WriteStartObject(); writer.WritePropertyName("multi_terms"); writer.WriteStartObject(); + if (value.CollectMode is not null) + { + writer.WritePropertyName("collect_mode"); + JsonSerializer.Serialize(writer, value.CollectMode, options); + } + + if (value.MinDocCount.HasValue) + { + writer.WritePropertyName("min_doc_count"); + writer.WriteNumberValue(value.MinDocCount.Value); + } + + if (value.Order is not null) + { + writer.WritePropertyName("order"); + JsonSerializer.Serialize(writer, value.Order, options); + } + + if (value.ShardMinDocCount.HasValue) + { + writer.WritePropertyName("shard_min_doc_count"); + writer.WriteNumberValue(value.ShardMinDocCount.Value); + } + + if (value.ShardSize.HasValue) + { + writer.WritePropertyName("shard_size"); + writer.WriteNumberValue(value.ShardSize.Value); + } + + if (value.ShowTermDocCountError.HasValue) + { + writer.WritePropertyName("show_term_doc_count_error"); + writer.WriteBooleanValue(value.ShowTermDocCountError.Value); + } + + if (value.Size.HasValue) + { + writer.WritePropertyName("size"); + writer.WriteNumberValue(value.Size.Value); + } + writer.WritePropertyName("terms"); JsonSerializer.Serialize(writer, value.Terms, options); writer.WriteEndObject(); @@ -115,6 +234,34 @@ public MultiTermsAggregation(string name) : base(name) { } + [JsonInclude] + [JsonPropertyName("collect_mode")] + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationCollectMode? CollectMode { get; set; } + + [JsonInclude] + [JsonPropertyName("min_doc_count")] + public long? MinDocCount { get; set; } + + [JsonInclude] + [JsonPropertyName("order")] + public Elastic.Clients.Elasticsearch.Aggregations.AggregateOrder? Order { get; set; } + + [JsonInclude] + [JsonPropertyName("shard_min_doc_count")] + public long? ShardMinDocCount { get; set; } + + [JsonInclude] + [JsonPropertyName("shard_size")] + public int? ShardSize { get; set; } + + [JsonInclude] + [JsonPropertyName("show_term_doc_count_error")] + public bool? ShowTermDocCountError { get; set; } + + [JsonInclude] + [JsonPropertyName("size")] + public int? Size { get; set; } + [JsonInclude] [JsonPropertyName("terms")] public IEnumerable Terms { get; set; } @@ -141,8 +288,22 @@ public MultiTermsAggregationDescriptor() : base() private Action>[] TermsDescriptorActions { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationCollectMode? CollectModeValue { get; set; } + private Dictionary? MetaValue { get; set; } + private long? MinDocCountValue { get; set; } + + private Elastic.Clients.Elasticsearch.Aggregations.AggregateOrder? OrderValue { get; set; } + + private long? ShardMinDocCountValue { get; set; } + + private int? ShardSizeValue { get; set; } + + private bool? ShowTermDocCountErrorValue { get; set; } + + private int? SizeValue { get; set; } + public MultiTermsAggregationDescriptor Aggregations(Elastic.Clients.Elasticsearch.Aggregations.AggregationDictionary? aggregations) { AggregationsDescriptor = null; @@ -203,12 +364,54 @@ public MultiTermsAggregationDescriptor Terms(params Action CollectMode(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationCollectMode? collectMode) + { + CollectModeValue = collectMode; + return Self; + } + public MultiTermsAggregationDescriptor Meta(Func, FluentDictionary> selector) { MetaValue = selector?.Invoke(new FluentDictionary()); return Self; } + public MultiTermsAggregationDescriptor MinDocCount(long? minDocCount) + { + MinDocCountValue = minDocCount; + return Self; + } + + public MultiTermsAggregationDescriptor Order(Elastic.Clients.Elasticsearch.Aggregations.AggregateOrder? order) + { + OrderValue = order; + return Self; + } + + public MultiTermsAggregationDescriptor ShardMinDocCount(long? shardMinDocCount) + { + ShardMinDocCountValue = shardMinDocCount; + return Self; + } + + public MultiTermsAggregationDescriptor ShardSize(int? shardSize) + { + ShardSizeValue = shardSize; + return Self; + } + + public MultiTermsAggregationDescriptor ShowTermDocCountError(bool? showTermDocCountError = true) + { + ShowTermDocCountErrorValue = showTermDocCountError; + return Self; + } + + public MultiTermsAggregationDescriptor Size(int? size) + { + SizeValue = size; + return Self; + } + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) { writer.WriteStartObject(); @@ -241,6 +444,48 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o JsonSerializer.Serialize(writer, TermsValue, options); } + if (CollectModeValue is not null) + { + writer.WritePropertyName("collect_mode"); + JsonSerializer.Serialize(writer, CollectModeValue, options); + } + + if (MinDocCountValue.HasValue) + { + writer.WritePropertyName("min_doc_count"); + writer.WriteNumberValue(MinDocCountValue.Value); + } + + if (OrderValue is not null) + { + writer.WritePropertyName("order"); + JsonSerializer.Serialize(writer, OrderValue, options); + } + + if (ShardMinDocCountValue.HasValue) + { + writer.WritePropertyName("shard_min_doc_count"); + writer.WriteNumberValue(ShardMinDocCountValue.Value); + } + + if (ShardSizeValue.HasValue) + { + writer.WritePropertyName("shard_size"); + writer.WriteNumberValue(ShardSizeValue.Value); + } + + if (ShowTermDocCountErrorValue.HasValue) + { + writer.WritePropertyName("show_term_doc_count_error"); + writer.WriteBooleanValue(ShowTermDocCountErrorValue.Value); + } + + if (SizeValue.HasValue) + { + writer.WritePropertyName("size"); + writer.WriteNumberValue(SizeValue.Value); + } + writer.WriteEndObject(); if (MetaValue is not null) { @@ -289,8 +534,22 @@ public MultiTermsAggregationDescriptor() : base() private Action[] TermsDescriptorActions { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationCollectMode? CollectModeValue { get; set; } + private Dictionary? MetaValue { get; set; } + private long? MinDocCountValue { get; set; } + + private Elastic.Clients.Elasticsearch.Aggregations.AggregateOrder? OrderValue { get; set; } + + private long? ShardMinDocCountValue { get; set; } + + private int? ShardSizeValue { get; set; } + + private bool? ShowTermDocCountErrorValue { get; set; } + + private int? SizeValue { get; set; } + public MultiTermsAggregationDescriptor Aggregations(Elastic.Clients.Elasticsearch.Aggregations.AggregationDictionary? aggregations) { AggregationsDescriptor = null; @@ -351,12 +610,54 @@ public MultiTermsAggregationDescriptor Terms(params Action, FluentDictionary> selector) { MetaValue = selector?.Invoke(new FluentDictionary()); return Self; } + public MultiTermsAggregationDescriptor MinDocCount(long? minDocCount) + { + MinDocCountValue = minDocCount; + return Self; + } + + public MultiTermsAggregationDescriptor Order(Elastic.Clients.Elasticsearch.Aggregations.AggregateOrder? order) + { + OrderValue = order; + return Self; + } + + public MultiTermsAggregationDescriptor ShardMinDocCount(long? shardMinDocCount) + { + ShardMinDocCountValue = shardMinDocCount; + return Self; + } + + public MultiTermsAggregationDescriptor ShardSize(int? shardSize) + { + ShardSizeValue = shardSize; + return Self; + } + + public MultiTermsAggregationDescriptor ShowTermDocCountError(bool? showTermDocCountError = true) + { + ShowTermDocCountErrorValue = showTermDocCountError; + return Self; + } + + public MultiTermsAggregationDescriptor Size(int? size) + { + SizeValue = size; + return Self; + } + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) { writer.WriteStartObject(); @@ -389,6 +690,48 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o JsonSerializer.Serialize(writer, TermsValue, options); } + if (CollectModeValue is not null) + { + writer.WritePropertyName("collect_mode"); + JsonSerializer.Serialize(writer, CollectModeValue, options); + } + + if (MinDocCountValue.HasValue) + { + writer.WritePropertyName("min_doc_count"); + writer.WriteNumberValue(MinDocCountValue.Value); + } + + if (OrderValue is not null) + { + writer.WritePropertyName("order"); + JsonSerializer.Serialize(writer, OrderValue, options); + } + + if (ShardMinDocCountValue.HasValue) + { + writer.WritePropertyName("shard_min_doc_count"); + writer.WriteNumberValue(ShardMinDocCountValue.Value); + } + + if (ShardSizeValue.HasValue) + { + writer.WritePropertyName("shard_size"); + writer.WriteNumberValue(ShardSizeValue.Value); + } + + if (ShowTermDocCountErrorValue.HasValue) + { + writer.WritePropertyName("show_term_doc_count_error"); + writer.WriteBooleanValue(ShowTermDocCountErrorValue.Value); + } + + if (SizeValue.HasValue) + { + writer.WritePropertyName("size"); + writer.WriteNumberValue(SizeValue.Value); + } + writer.WriteEndObject(); if (MetaValue is not null) { diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/AsciiFoldingTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/AsciiFoldingTokenFilter.g.cs index 809ea4988bb..10955bb62d9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/AsciiFoldingTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/AsciiFoldingTokenFilter.g.cs @@ -28,7 +28,7 @@ public partial class AsciiFoldingTokenFilter : TokenFilterBase, ITokenFilterDefi { [JsonInclude] [JsonPropertyName("preserve_original")] - public bool PreserveOriginal { get; set; } + public bool? PreserveOriginal { get; set; } [JsonInclude] [JsonPropertyName("type")] @@ -42,11 +42,11 @@ public AsciiFoldingTokenFilterDescriptor() : base() { } - private bool PreserveOriginalValue { get; set; } + private bool? PreserveOriginalValue { get; set; } private string? VersionValue { get; set; } - public AsciiFoldingTokenFilterDescriptor PreserveOriginal(bool preserveOriginal = true) + public AsciiFoldingTokenFilterDescriptor PreserveOriginal(bool? preserveOriginal = true) { PreserveOriginalValue = preserveOriginal; return Self; @@ -61,8 +61,12 @@ public AsciiFoldingTokenFilterDescriptor Version(string? version) protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) { writer.WriteStartObject(); - writer.WritePropertyName("preserve_original"); - writer.WriteBooleanValue(PreserveOriginalValue); + if (PreserveOriginalValue.HasValue) + { + writer.WritePropertyName("preserve_original"); + writer.WriteBooleanValue(PreserveOriginalValue.Value); + } + writer.WritePropertyName("type"); writer.WriteStringValue("asciifolding"); if (VersionValue is not null) diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/DelimitedPayloadTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/DelimitedPayloadTokenFilter.g.cs index f477db42098..ec9b1e84b85 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/DelimitedPayloadTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/DelimitedPayloadTokenFilter.g.cs @@ -28,11 +28,11 @@ public partial class DelimitedPayloadTokenFilter : TokenFilterBase, ITokenFilter { [JsonInclude] [JsonPropertyName("delimiter")] - public string Delimiter { get; set; } + public string? Delimiter { get; set; } [JsonInclude] [JsonPropertyName("encoding")] - public Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadEncoding Encoding { get; set; } + public Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadEncoding? Encoding { get; set; } [JsonInclude] [JsonPropertyName("type")] @@ -46,19 +46,19 @@ public DelimitedPayloadTokenFilterDescriptor() : base() { } - private string DelimiterValue { get; set; } + private string? DelimiterValue { get; set; } - private Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadEncoding EncodingValue { get; set; } + private Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadEncoding? EncodingValue { get; set; } private string? VersionValue { get; set; } - public DelimitedPayloadTokenFilterDescriptor Delimiter(string delimiter) + public DelimitedPayloadTokenFilterDescriptor Delimiter(string? delimiter) { DelimiterValue = delimiter; return Self; } - public DelimitedPayloadTokenFilterDescriptor Encoding(Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadEncoding encoding) + public DelimitedPayloadTokenFilterDescriptor Encoding(Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadEncoding? encoding) { EncodingValue = encoding; return Self; @@ -73,10 +73,18 @@ public DelimitedPayloadTokenFilterDescriptor Version(string? version) protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) { writer.WriteStartObject(); - writer.WritePropertyName("delimiter"); - writer.WriteStringValue(DelimiterValue); - writer.WritePropertyName("encoding"); - JsonSerializer.Serialize(writer, EncodingValue, options); + if (!string.IsNullOrEmpty(DelimiterValue)) + { + writer.WritePropertyName("delimiter"); + writer.WriteStringValue(DelimiterValue); + } + + if (EncodingValue is not null) + { + writer.WritePropertyName("encoding"); + JsonSerializer.Serialize(writer, EncodingValue, options); + } + writer.WritePropertyName("type"); writer.WriteStringValue("delimited_payload"); if (VersionValue is not null) diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/EdgeNGramTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/EdgeNGramTokenFilter.g.cs index bd904cf669d..3f29d5576f2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/EdgeNGramTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/EdgeNGramTokenFilter.g.cs @@ -28,11 +28,11 @@ public partial class EdgeNGramTokenFilter : TokenFilterBase, ITokenFilterDefinit { [JsonInclude] [JsonPropertyName("max_gram")] - public int MaxGram { get; set; } + public int? MaxGram { get; set; } [JsonInclude] [JsonPropertyName("min_gram")] - public int MinGram { get; set; } + public int? MinGram { get; set; } [JsonInclude] [JsonPropertyName("preserve_original")] @@ -54,9 +54,9 @@ public EdgeNGramTokenFilterDescriptor() : base() { } - private int MaxGramValue { get; set; } + private int? MaxGramValue { get; set; } - private int MinGramValue { get; set; } + private int? MinGramValue { get; set; } private bool? PreserveOriginalValue { get; set; } @@ -64,13 +64,13 @@ public EdgeNGramTokenFilterDescriptor() : base() private string? VersionValue { get; set; } - public EdgeNGramTokenFilterDescriptor MaxGram(int maxGram) + public EdgeNGramTokenFilterDescriptor MaxGram(int? maxGram) { MaxGramValue = maxGram; return Self; } - public EdgeNGramTokenFilterDescriptor MinGram(int minGram) + public EdgeNGramTokenFilterDescriptor MinGram(int? minGram) { MinGramValue = minGram; return Self; @@ -97,10 +97,18 @@ public EdgeNGramTokenFilterDescriptor Version(string? version) protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) { writer.WriteStartObject(); - writer.WritePropertyName("max_gram"); - writer.WriteNumberValue(MaxGramValue); - writer.WritePropertyName("min_gram"); - writer.WriteNumberValue(MinGramValue); + if (MaxGramValue.HasValue) + { + writer.WritePropertyName("max_gram"); + writer.WriteNumberValue(MaxGramValue.Value); + } + + if (MinGramValue.HasValue) + { + writer.WritePropertyName("min_gram"); + writer.WriteNumberValue(MinGramValue.Value); + } + if (PreserveOriginalValue.HasValue) { writer.WritePropertyName("preserve_original"); diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ElisionTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ElisionTokenFilter.g.cs index a5245f1be0e..1d5259c0678 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ElisionTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ElisionTokenFilter.g.cs @@ -28,11 +28,15 @@ public partial class ElisionTokenFilter : TokenFilterBase, ITokenFilterDefinitio { [JsonInclude] [JsonPropertyName("articles")] - public IEnumerable Articles { get; set; } + public IEnumerable? Articles { get; set; } [JsonInclude] [JsonPropertyName("articles_case")] - public bool ArticlesCase { get; set; } + public bool? ArticlesCase { get; set; } + + [JsonInclude] + [JsonPropertyName("articles_path")] + public string? ArticlesPath { get; set; } [JsonInclude] [JsonPropertyName("type")] @@ -46,24 +50,32 @@ public ElisionTokenFilterDescriptor() : base() { } - private IEnumerable ArticlesValue { get; set; } + private IEnumerable? ArticlesValue { get; set; } - private bool ArticlesCaseValue { get; set; } + private bool? ArticlesCaseValue { get; set; } + + private string? ArticlesPathValue { get; set; } private string? VersionValue { get; set; } - public ElisionTokenFilterDescriptor Articles(IEnumerable articles) + public ElisionTokenFilterDescriptor Articles(IEnumerable? articles) { ArticlesValue = articles; return Self; } - public ElisionTokenFilterDescriptor ArticlesCase(bool articlesCase = true) + public ElisionTokenFilterDescriptor ArticlesCase(bool? articlesCase = true) { ArticlesCaseValue = articlesCase; return Self; } + public ElisionTokenFilterDescriptor ArticlesPath(string? articlesPath) + { + ArticlesPathValue = articlesPath; + return Self; + } + public ElisionTokenFilterDescriptor Version(string? version) { VersionValue = version; @@ -73,10 +85,24 @@ public ElisionTokenFilterDescriptor Version(string? version) protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) { writer.WriteStartObject(); - writer.WritePropertyName("articles"); - JsonSerializer.Serialize(writer, ArticlesValue, options); - writer.WritePropertyName("articles_case"); - writer.WriteBooleanValue(ArticlesCaseValue); + if (ArticlesValue is not null) + { + writer.WritePropertyName("articles"); + JsonSerializer.Serialize(writer, ArticlesValue, options); + } + + if (ArticlesCaseValue.HasValue) + { + writer.WritePropertyName("articles_case"); + writer.WriteBooleanValue(ArticlesCaseValue.Value); + } + + if (!string.IsNullOrEmpty(ArticlesPathValue)) + { + writer.WritePropertyName("articles_path"); + writer.WriteStringValue(ArticlesPathValue); + } + writer.WritePropertyName("type"); writer.WriteStringValue("elision"); if (VersionValue is not null) @@ -89,6 +115,6 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o } ElisionTokenFilter IBuildableDescriptor.Build() => new() - { Articles = ArticlesValue, ArticlesCase = ArticlesCaseValue, Version = VersionValue }; + { Articles = ArticlesValue, ArticlesCase = ArticlesCaseValue, ArticlesPath = ArticlesPathValue, Version = VersionValue }; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/FingerprintTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/FingerprintTokenFilter.g.cs index f241a687c01..f97d2ed14f4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/FingerprintTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/FingerprintTokenFilter.g.cs @@ -28,11 +28,11 @@ public partial class FingerprintTokenFilter : TokenFilterBase, ITokenFilterDefin { [JsonInclude] [JsonPropertyName("max_output_size")] - public int MaxOutputSize { get; set; } + public int? MaxOutputSize { get; set; } [JsonInclude] [JsonPropertyName("separator")] - public string Separator { get; set; } + public string? Separator { get; set; } [JsonInclude] [JsonPropertyName("type")] @@ -46,19 +46,19 @@ public FingerprintTokenFilterDescriptor() : base() { } - private int MaxOutputSizeValue { get; set; } + private int? MaxOutputSizeValue { get; set; } - private string SeparatorValue { get; set; } + private string? SeparatorValue { get; set; } private string? VersionValue { get; set; } - public FingerprintTokenFilterDescriptor MaxOutputSize(int maxOutputSize) + public FingerprintTokenFilterDescriptor MaxOutputSize(int? maxOutputSize) { MaxOutputSizeValue = maxOutputSize; return Self; } - public FingerprintTokenFilterDescriptor Separator(string separator) + public FingerprintTokenFilterDescriptor Separator(string? separator) { SeparatorValue = separator; return Self; @@ -73,10 +73,18 @@ public FingerprintTokenFilterDescriptor Version(string? version) protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) { writer.WriteStartObject(); - writer.WritePropertyName("max_output_size"); - writer.WriteNumberValue(MaxOutputSizeValue); - writer.WritePropertyName("separator"); - writer.WriteStringValue(SeparatorValue); + if (MaxOutputSizeValue.HasValue) + { + writer.WritePropertyName("max_output_size"); + writer.WriteNumberValue(MaxOutputSizeValue.Value); + } + + if (!string.IsNullOrEmpty(SeparatorValue)) + { + writer.WritePropertyName("separator"); + writer.WriteStringValue(SeparatorValue); + } + writer.WritePropertyName("type"); writer.WriteStringValue("fingerprint"); if (VersionValue is not null) diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/HunspellTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/HunspellTokenFilter.g.cs index 70c1f49782b..3018d7e65aa 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/HunspellTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/HunspellTokenFilter.g.cs @@ -28,11 +28,11 @@ public partial class HunspellTokenFilter : TokenFilterBase, ITokenFilterDefiniti { [JsonInclude] [JsonPropertyName("dedup")] - public bool Dedup { get; set; } + public bool? Dedup { get; set; } [JsonInclude] [JsonPropertyName("dictionary")] - public string Dictionary { get; set; } + public string? Dictionary { get; set; } [JsonInclude] [JsonPropertyName("locale")] @@ -40,7 +40,7 @@ public partial class HunspellTokenFilter : TokenFilterBase, ITokenFilterDefiniti [JsonInclude] [JsonPropertyName("longest_only")] - public bool LongestOnly { get; set; } + public bool? LongestOnly { get; set; } [JsonInclude] [JsonPropertyName("type")] @@ -54,23 +54,23 @@ public HunspellTokenFilterDescriptor() : base() { } - private bool DedupValue { get; set; } + private bool? DedupValue { get; set; } - private string DictionaryValue { get; set; } + private string? DictionaryValue { get; set; } private string LocaleValue { get; set; } - private bool LongestOnlyValue { get; set; } + private bool? LongestOnlyValue { get; set; } private string? VersionValue { get; set; } - public HunspellTokenFilterDescriptor Dedup(bool dedup = true) + public HunspellTokenFilterDescriptor Dedup(bool? dedup = true) { DedupValue = dedup; return Self; } - public HunspellTokenFilterDescriptor Dictionary(string dictionary) + public HunspellTokenFilterDescriptor Dictionary(string? dictionary) { DictionaryValue = dictionary; return Self; @@ -82,7 +82,7 @@ public HunspellTokenFilterDescriptor Locale(string locale) return Self; } - public HunspellTokenFilterDescriptor LongestOnly(bool longestOnly = true) + public HunspellTokenFilterDescriptor LongestOnly(bool? longestOnly = true) { LongestOnlyValue = longestOnly; return Self; @@ -97,14 +97,26 @@ public HunspellTokenFilterDescriptor Version(string? version) protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) { writer.WriteStartObject(); - writer.WritePropertyName("dedup"); - writer.WriteBooleanValue(DedupValue); - writer.WritePropertyName("dictionary"); - writer.WriteStringValue(DictionaryValue); + if (DedupValue.HasValue) + { + writer.WritePropertyName("dedup"); + writer.WriteBooleanValue(DedupValue.Value); + } + + if (!string.IsNullOrEmpty(DictionaryValue)) + { + writer.WritePropertyName("dictionary"); + writer.WriteStringValue(DictionaryValue); + } + writer.WritePropertyName("locale"); writer.WriteStringValue(LocaleValue); - writer.WritePropertyName("longest_only"); - writer.WriteBooleanValue(LongestOnlyValue); + if (LongestOnlyValue.HasValue) + { + writer.WritePropertyName("longest_only"); + writer.WriteBooleanValue(LongestOnlyValue.Value); + } + writer.WritePropertyName("type"); writer.WriteStringValue("hunspell"); if (VersionValue is not null) diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/LengthTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/LengthTokenFilter.g.cs index ee94212ce49..65e6b9de793 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/LengthTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/LengthTokenFilter.g.cs @@ -28,11 +28,11 @@ public partial class LengthTokenFilter : TokenFilterBase, ITokenFilterDefinition { [JsonInclude] [JsonPropertyName("max")] - public int Max { get; set; } + public int? Max { get; set; } [JsonInclude] [JsonPropertyName("min")] - public int Min { get; set; } + public int? Min { get; set; } [JsonInclude] [JsonPropertyName("type")] @@ -46,19 +46,19 @@ public LengthTokenFilterDescriptor() : base() { } - private int MaxValue { get; set; } + private int? MaxValue { get; set; } - private int MinValue { get; set; } + private int? MinValue { get; set; } private string? VersionValue { get; set; } - public LengthTokenFilterDescriptor Max(int max) + public LengthTokenFilterDescriptor Max(int? max) { MaxValue = max; return Self; } - public LengthTokenFilterDescriptor Min(int min) + public LengthTokenFilterDescriptor Min(int? min) { MinValue = min; return Self; @@ -73,10 +73,18 @@ public LengthTokenFilterDescriptor Version(string? version) protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) { writer.WriteStartObject(); - writer.WritePropertyName("max"); - writer.WriteNumberValue(MaxValue); - writer.WritePropertyName("min"); - writer.WriteNumberValue(MinValue); + if (MaxValue.HasValue) + { + writer.WritePropertyName("max"); + writer.WriteNumberValue(MaxValue.Value); + } + + if (MinValue.HasValue) + { + writer.WritePropertyName("min"); + writer.WriteNumberValue(MinValue.Value); + } + writer.WritePropertyName("type"); writer.WriteStringValue("length"); if (VersionValue is not null) diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/LimitTokenCountTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/LimitTokenCountTokenFilter.g.cs index 34f1765d477..026535cbbf4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/LimitTokenCountTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/LimitTokenCountTokenFilter.g.cs @@ -28,11 +28,11 @@ public partial class LimitTokenCountTokenFilter : TokenFilterBase, ITokenFilterD { [JsonInclude] [JsonPropertyName("consume_all_tokens")] - public bool ConsumeAllTokens { get; set; } + public bool? ConsumeAllTokens { get; set; } [JsonInclude] [JsonPropertyName("max_token_count")] - public int MaxTokenCount { get; set; } + public int? MaxTokenCount { get; set; } [JsonInclude] [JsonPropertyName("type")] @@ -46,19 +46,19 @@ public LimitTokenCountTokenFilterDescriptor() : base() { } - private bool ConsumeAllTokensValue { get; set; } + private bool? ConsumeAllTokensValue { get; set; } - private int MaxTokenCountValue { get; set; } + private int? MaxTokenCountValue { get; set; } private string? VersionValue { get; set; } - public LimitTokenCountTokenFilterDescriptor ConsumeAllTokens(bool consumeAllTokens = true) + public LimitTokenCountTokenFilterDescriptor ConsumeAllTokens(bool? consumeAllTokens = true) { ConsumeAllTokensValue = consumeAllTokens; return Self; } - public LimitTokenCountTokenFilterDescriptor MaxTokenCount(int maxTokenCount) + public LimitTokenCountTokenFilterDescriptor MaxTokenCount(int? maxTokenCount) { MaxTokenCountValue = maxTokenCount; return Self; @@ -73,10 +73,18 @@ public LimitTokenCountTokenFilterDescriptor Version(string? version) protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) { writer.WriteStartObject(); - writer.WritePropertyName("consume_all_tokens"); - writer.WriteBooleanValue(ConsumeAllTokensValue); - writer.WritePropertyName("max_token_count"); - writer.WriteNumberValue(MaxTokenCountValue); + if (ConsumeAllTokensValue.HasValue) + { + writer.WritePropertyName("consume_all_tokens"); + writer.WriteBooleanValue(ConsumeAllTokensValue.Value); + } + + if (MaxTokenCountValue.HasValue) + { + writer.WritePropertyName("max_token_count"); + writer.WriteNumberValue(MaxTokenCountValue.Value); + } + writer.WritePropertyName("type"); writer.WriteStringValue("limit"); if (VersionValue is not null) diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/MultiplexerTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/MultiplexerTokenFilter.g.cs index 609a0b6e724..643ae5d39e0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/MultiplexerTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/MultiplexerTokenFilter.g.cs @@ -32,7 +32,7 @@ public partial class MultiplexerTokenFilter : TokenFilterBase, ITokenFilterDefin [JsonInclude] [JsonPropertyName("preserve_original")] - public bool PreserveOriginal { get; set; } + public bool? PreserveOriginal { get; set; } [JsonInclude] [JsonPropertyName("type")] @@ -48,7 +48,7 @@ public MultiplexerTokenFilterDescriptor() : base() private IEnumerable FiltersValue { get; set; } - private bool PreserveOriginalValue { get; set; } + private bool? PreserveOriginalValue { get; set; } private string? VersionValue { get; set; } @@ -58,7 +58,7 @@ public MultiplexerTokenFilterDescriptor Filters(IEnumerable filters) return Self; } - public MultiplexerTokenFilterDescriptor PreserveOriginal(bool preserveOriginal = true) + public MultiplexerTokenFilterDescriptor PreserveOriginal(bool? preserveOriginal = true) { PreserveOriginalValue = preserveOriginal; return Self; @@ -75,8 +75,12 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o writer.WriteStartObject(); writer.WritePropertyName("filters"); JsonSerializer.Serialize(writer, FiltersValue, options); - writer.WritePropertyName("preserve_original"); - writer.WriteBooleanValue(PreserveOriginalValue); + if (PreserveOriginalValue.HasValue) + { + writer.WritePropertyName("preserve_original"); + writer.WriteBooleanValue(PreserveOriginalValue.Value); + } + writer.WritePropertyName("type"); writer.WriteStringValue("multiplexer"); if (VersionValue is not null) diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/NoriPartOfSpeechTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/NoriPartOfSpeechTokenFilter.g.cs index 8798ae3e160..beb7c55a066 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/NoriPartOfSpeechTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/NoriPartOfSpeechTokenFilter.g.cs @@ -28,7 +28,7 @@ public partial class NoriPartOfSpeechTokenFilter : TokenFilterBase, ITokenFilter { [JsonInclude] [JsonPropertyName("stoptags")] - public IEnumerable Stoptags { get; set; } + public IEnumerable? Stoptags { get; set; } [JsonInclude] [JsonPropertyName("type")] @@ -42,11 +42,11 @@ public NoriPartOfSpeechTokenFilterDescriptor() : base() { } - private IEnumerable StoptagsValue { get; set; } + private IEnumerable? StoptagsValue { get; set; } private string? VersionValue { get; set; } - public NoriPartOfSpeechTokenFilterDescriptor Stoptags(IEnumerable stoptags) + public NoriPartOfSpeechTokenFilterDescriptor Stoptags(IEnumerable? stoptags) { StoptagsValue = stoptags; return Self; @@ -61,8 +61,12 @@ public NoriPartOfSpeechTokenFilterDescriptor Version(string? version) protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) { writer.WriteStartObject(); - writer.WritePropertyName("stoptags"); - JsonSerializer.Serialize(writer, StoptagsValue, options); + if (StoptagsValue is not null) + { + writer.WritePropertyName("stoptags"); + JsonSerializer.Serialize(writer, StoptagsValue, options); + } + writer.WritePropertyName("type"); writer.WriteStringValue("nori_part_of_speech"); if (VersionValue is not null) diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PatternCaptureTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PatternCaptureTokenFilter.g.cs index d40db1e247d..a73e3d11594 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PatternCaptureTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PatternCaptureTokenFilter.g.cs @@ -32,7 +32,7 @@ public partial class PatternCaptureTokenFilter : TokenFilterBase, ITokenFilterDe [JsonInclude] [JsonPropertyName("preserve_original")] - public bool PreserveOriginal { get; set; } + public bool? PreserveOriginal { get; set; } [JsonInclude] [JsonPropertyName("type")] @@ -48,7 +48,7 @@ public PatternCaptureTokenFilterDescriptor() : base() private IEnumerable PatternsValue { get; set; } - private bool PreserveOriginalValue { get; set; } + private bool? PreserveOriginalValue { get; set; } private string? VersionValue { get; set; } @@ -58,7 +58,7 @@ public PatternCaptureTokenFilterDescriptor Patterns(IEnumerable patterns return Self; } - public PatternCaptureTokenFilterDescriptor PreserveOriginal(bool preserveOriginal = true) + public PatternCaptureTokenFilterDescriptor PreserveOriginal(bool? preserveOriginal = true) { PreserveOriginalValue = preserveOriginal; return Self; @@ -75,8 +75,12 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o writer.WriteStartObject(); writer.WritePropertyName("patterns"); JsonSerializer.Serialize(writer, PatternsValue, options); - writer.WritePropertyName("preserve_original"); - writer.WriteBooleanValue(PreserveOriginalValue); + if (PreserveOriginalValue.HasValue) + { + writer.WritePropertyName("preserve_original"); + writer.WriteBooleanValue(PreserveOriginalValue.Value); + } + writer.WritePropertyName("type"); writer.WriteStringValue("pattern_capture"); if (VersionValue is not null) diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PatternReplaceTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PatternReplaceTokenFilter.g.cs index 49e9af760e3..1849e10625d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PatternReplaceTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PatternReplaceTokenFilter.g.cs @@ -26,9 +26,13 @@ namespace Elastic.Clients.Elasticsearch.Analysis { public partial class PatternReplaceTokenFilter : TokenFilterBase, ITokenFilterDefinition { + [JsonInclude] + [JsonPropertyName("all")] + public bool? All { get; set; } + [JsonInclude] [JsonPropertyName("flags")] - public string Flags { get; set; } + public string? Flags { get; set; } [JsonInclude] [JsonPropertyName("pattern")] @@ -36,7 +40,7 @@ public partial class PatternReplaceTokenFilter : TokenFilterBase, ITokenFilterDe [JsonInclude] [JsonPropertyName("replacement")] - public string Replacement { get; set; } + public string? Replacement { get; set; } [JsonInclude] [JsonPropertyName("type")] @@ -50,15 +54,23 @@ public PatternReplaceTokenFilterDescriptor() : base() { } - private string FlagsValue { get; set; } + private bool? AllValue { get; set; } + + private string? FlagsValue { get; set; } private string PatternValue { get; set; } - private string ReplacementValue { get; set; } + private string? ReplacementValue { get; set; } private string? VersionValue { get; set; } - public PatternReplaceTokenFilterDescriptor Flags(string flags) + public PatternReplaceTokenFilterDescriptor All(bool? all = true) + { + AllValue = all; + return Self; + } + + public PatternReplaceTokenFilterDescriptor Flags(string? flags) { FlagsValue = flags; return Self; @@ -70,7 +82,7 @@ public PatternReplaceTokenFilterDescriptor Pattern(string pattern) return Self; } - public PatternReplaceTokenFilterDescriptor Replacement(string replacement) + public PatternReplaceTokenFilterDescriptor Replacement(string? replacement) { ReplacementValue = replacement; return Self; @@ -85,12 +97,26 @@ public PatternReplaceTokenFilterDescriptor Version(string? version) protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) { writer.WriteStartObject(); - writer.WritePropertyName("flags"); - writer.WriteStringValue(FlagsValue); + if (AllValue.HasValue) + { + writer.WritePropertyName("all"); + writer.WriteBooleanValue(AllValue.Value); + } + + if (!string.IsNullOrEmpty(FlagsValue)) + { + writer.WritePropertyName("flags"); + writer.WriteStringValue(FlagsValue); + } + writer.WritePropertyName("pattern"); writer.WriteStringValue(PatternValue); - writer.WritePropertyName("replacement"); - writer.WriteStringValue(ReplacementValue); + if (!string.IsNullOrEmpty(ReplacementValue)) + { + writer.WritePropertyName("replacement"); + writer.WriteStringValue(ReplacementValue); + } + writer.WritePropertyName("type"); writer.WriteStringValue("pattern_replace"); if (VersionValue is not null) @@ -103,6 +129,6 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o } PatternReplaceTokenFilter IBuildableDescriptor.Build() => new() - { Flags = FlagsValue, Pattern = PatternValue, Replacement = ReplacementValue, Version = VersionValue }; + { All = AllValue, Flags = FlagsValue, Pattern = PatternValue, Replacement = ReplacementValue, Version = VersionValue }; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/StopTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/StopTokenFilter.g.cs index d2cff192cc7..4b824c62e92 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/StopTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/StopTokenFilter.g.cs @@ -36,7 +36,7 @@ public partial class StopTokenFilter : TokenFilterBase, ITokenFilterDefinition [JsonInclude] [JsonPropertyName("stopwords")] - public Elastic.Clients.Elasticsearch.Analysis.StopWords Stopwords { get; set; } + public Elastic.Clients.Elasticsearch.Analysis.StopWords? Stopwords { get; set; } [JsonInclude] [JsonPropertyName("stopwords_path")] @@ -58,7 +58,7 @@ public StopTokenFilterDescriptor() : base() private bool? RemoveTrailingValue { get; set; } - private Elastic.Clients.Elasticsearch.Analysis.StopWords StopwordsValue { get; set; } + private Elastic.Clients.Elasticsearch.Analysis.StopWords? StopwordsValue { get; set; } private string? StopwordsPathValue { get; set; } @@ -76,7 +76,7 @@ public StopTokenFilterDescriptor RemoveTrailing(bool? removeTrailing = true) return Self; } - public StopTokenFilterDescriptor Stopwords(Elastic.Clients.Elasticsearch.Analysis.StopWords stopwords) + public StopTokenFilterDescriptor Stopwords(Elastic.Clients.Elasticsearch.Analysis.StopWords? stopwords) { StopwordsValue = stopwords; return Self; @@ -109,8 +109,12 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o writer.WriteBooleanValue(RemoveTrailingValue.Value); } - writer.WritePropertyName("stopwords"); - JsonSerializer.Serialize(writer, StopwordsValue, options); + if (StopwordsValue is not null) + { + writer.WritePropertyName("stopwords"); + JsonSerializer.Serialize(writer, StopwordsValue, options); + } + if (!string.IsNullOrEmpty(StopwordsPathValue)) { writer.WritePropertyName("stopwords_path"); diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/TruncateTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/TruncateTokenFilter.g.cs index b25315fb2f8..6efa5f31ddc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/TruncateTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/TruncateTokenFilter.g.cs @@ -28,7 +28,7 @@ public partial class TruncateTokenFilter : TokenFilterBase, ITokenFilterDefiniti { [JsonInclude] [JsonPropertyName("length")] - public int Length { get; set; } + public int? Length { get; set; } [JsonInclude] [JsonPropertyName("type")] @@ -42,11 +42,11 @@ public TruncateTokenFilterDescriptor() : base() { } - private int LengthValue { get; set; } + private int? LengthValue { get; set; } private string? VersionValue { get; set; } - public TruncateTokenFilterDescriptor Length(int length) + public TruncateTokenFilterDescriptor Length(int? length) { LengthValue = length; return Self; @@ -61,8 +61,12 @@ public TruncateTokenFilterDescriptor Version(string? version) protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) { writer.WriteStartObject(); - writer.WritePropertyName("length"); - writer.WriteNumberValue(LengthValue); + if (LengthValue.HasValue) + { + writer.WritePropertyName("length"); + writer.WriteNumberValue(LengthValue.Value); + } + writer.WritePropertyName("type"); writer.WriteStringValue("truncate"); if (VersionValue is not null) diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexSettings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexSettings.g.cs index ee6377f56f6..6ed1740eb38 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexSettings.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexSettings.g.cs @@ -104,8 +104,8 @@ public partial class IndexSettings public bool? LoadFixedBitsetFiltersEagerly { get; set; } [JsonInclude] - [JsonPropertyName("mappings")] - public Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettings? Mappings { get; set; } + [JsonPropertyName("mapping")] + public Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettings? Mapping { get; set; } [JsonInclude] [JsonPropertyName("max_docvalue_fields_search")] @@ -345,11 +345,11 @@ public IndexSettingsDescriptor() : base() private bool? LoadFixedBitsetFiltersEagerlyValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettings? MappingsValue { get; set; } + private Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettings? MappingValue { get; set; } - private MappingLimitSettingsDescriptor MappingsDescriptor { get; set; } + private MappingLimitSettingsDescriptor MappingDescriptor { get; set; } - private Action MappingsDescriptorAction { get; set; } + private Action MappingDescriptorAction { get; set; } private int? MaxDocvalueFieldsSearchValue { get; set; } @@ -771,27 +771,27 @@ public IndexSettingsDescriptor LoadFixedBitsetFiltersEagerly(bool? lo return Self; } - public IndexSettingsDescriptor Mappings(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettings? mappings) + public IndexSettingsDescriptor Mapping(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettings? mapping) { - MappingsDescriptor = null; - MappingsDescriptorAction = null; - MappingsValue = mappings; + MappingDescriptor = null; + MappingDescriptorAction = null; + MappingValue = mapping; return Self; } - public IndexSettingsDescriptor Mappings(MappingLimitSettingsDescriptor descriptor) + public IndexSettingsDescriptor Mapping(MappingLimitSettingsDescriptor descriptor) { - MappingsValue = null; - MappingsDescriptorAction = null; - MappingsDescriptor = descriptor; + MappingValue = null; + MappingDescriptorAction = null; + MappingDescriptor = descriptor; return Self; } - public IndexSettingsDescriptor Mappings(Action configure) + public IndexSettingsDescriptor Mapping(Action configure) { - MappingsValue = null; - MappingsDescriptor = null; - MappingsDescriptorAction = configure; + MappingValue = null; + MappingDescriptor = null; + MappingDescriptorAction = configure; return Self; } @@ -1432,20 +1432,20 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o writer.WriteBooleanValue(LoadFixedBitsetFiltersEagerlyValue.Value); } - if (MappingsDescriptor is not null) + if (MappingDescriptor is not null) { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, MappingsDescriptor, options); + writer.WritePropertyName("mapping"); + JsonSerializer.Serialize(writer, MappingDescriptor, options); } - else if (MappingsDescriptorAction is not null) + else if (MappingDescriptorAction is not null) { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, new MappingLimitSettingsDescriptor(MappingsDescriptorAction), options); + writer.WritePropertyName("mapping"); + JsonSerializer.Serialize(writer, new MappingLimitSettingsDescriptor(MappingDescriptorAction), options); } - else if (MappingsValue is not null) + else if (MappingValue is not null) { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, MappingsValue, options); + writer.WritePropertyName("mapping"); + JsonSerializer.Serialize(writer, MappingValue, options); } if (MaxDocvalueFieldsSearchValue.HasValue) @@ -1861,11 +1861,11 @@ public IndexSettingsDescriptor() : base() private bool? LoadFixedBitsetFiltersEagerlyValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettings? MappingsValue { get; set; } + private Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettings? MappingValue { get; set; } - private MappingLimitSettingsDescriptor MappingsDescriptor { get; set; } + private MappingLimitSettingsDescriptor MappingDescriptor { get; set; } - private Action MappingsDescriptorAction { get; set; } + private Action MappingDescriptorAction { get; set; } private int? MaxDocvalueFieldsSearchValue { get; set; } @@ -2287,27 +2287,27 @@ public IndexSettingsDescriptor LoadFixedBitsetFiltersEagerly(bool? loadFixedBits return Self; } - public IndexSettingsDescriptor Mappings(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettings? mappings) + public IndexSettingsDescriptor Mapping(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettings? mapping) { - MappingsDescriptor = null; - MappingsDescriptorAction = null; - MappingsValue = mappings; + MappingDescriptor = null; + MappingDescriptorAction = null; + MappingValue = mapping; return Self; } - public IndexSettingsDescriptor Mappings(MappingLimitSettingsDescriptor descriptor) + public IndexSettingsDescriptor Mapping(MappingLimitSettingsDescriptor descriptor) { - MappingsValue = null; - MappingsDescriptorAction = null; - MappingsDescriptor = descriptor; + MappingValue = null; + MappingDescriptorAction = null; + MappingDescriptor = descriptor; return Self; } - public IndexSettingsDescriptor Mappings(Action configure) + public IndexSettingsDescriptor Mapping(Action configure) { - MappingsValue = null; - MappingsDescriptor = null; - MappingsDescriptorAction = configure; + MappingValue = null; + MappingDescriptor = null; + MappingDescriptorAction = configure; return Self; } @@ -2948,20 +2948,20 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o writer.WriteBooleanValue(LoadFixedBitsetFiltersEagerlyValue.Value); } - if (MappingsDescriptor is not null) + if (MappingDescriptor is not null) { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, MappingsDescriptor, options); + writer.WritePropertyName("mapping"); + JsonSerializer.Serialize(writer, MappingDescriptor, options); } - else if (MappingsDescriptorAction is not null) + else if (MappingDescriptorAction is not null) { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, new MappingLimitSettingsDescriptor(MappingsDescriptorAction), options); + writer.WritePropertyName("mapping"); + JsonSerializer.Serialize(writer, new MappingLimitSettingsDescriptor(MappingDescriptorAction), options); } - else if (MappingsValue is not null) + else if (MappingValue is not null) { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, MappingsValue, options); + writer.WritePropertyName("mapping"); + JsonSerializer.Serialize(writer, MappingValue, options); } if (MaxDocvalueFieldsSearchValue.HasValue) diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Migration/MigrationFeature.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Migration/MigrationFeature.g.cs index 72faf353cdd..79a7ea670eb 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Migration/MigrationFeature.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Migration/MigrationFeature.g.cs @@ -29,5 +29,17 @@ public partial class MigrationFeature [JsonInclude] [JsonPropertyName("feature_name")] public string FeatureName { get; init; } + + [JsonInclude] + [JsonPropertyName("indices")] + public IReadOnlyCollection Indices { get; init; } + + [JsonInclude] + [JsonPropertyName("migration_status")] + public Elastic.Clients.Elasticsearch.Migration.MigrationStatus MigrationStatus { get; init; } + + [JsonInclude] + [JsonPropertyName("minimum_index_version")] + public string MinimumIndexVersion { get; init; } } } \ No newline at end of file diff --git a/tests/Tests/Aggregations/Bucket/DateHistogramAggregationUsageTests.cs b/tests/Tests/Aggregations/Bucket/DateHistogramAggregationUsageTests.cs index 4a9b0ea7a62..12570b8eab8 100644 --- a/tests/Tests/Aggregations/Bucket/DateHistogramAggregationUsageTests.cs +++ b/tests/Tests/Aggregations/Bucket/DateHistogramAggregationUsageTests.cs @@ -27,7 +27,7 @@ public DateHistogramAggregationUsageTests(ReadOnlyCluster i, EndpointUsage usage calendar_interval = "month", min_doc_count = 2, format = "yyyy-MM-dd'T'HH:mm:ss||date_optional_time", // <1> Note the inclusion of `date_optional_time` to `format` - order = new { _count = "asc" }, + order = new { _key = "asc" }, //extended_bounds = new //{ // min = FixedDate.AddYears(-1), @@ -62,7 +62,7 @@ public DateHistogramAggregationUsageTests(ReadOnlyCluster i, EndpointUsage usage .MinDocCount(2) .Format("yyyy-MM-dd'T'HH:mm:ss||date_optional_time") //.ExtendedBounds(FixedDate.AddYears(-1), FixedDate.AddYears(1)) - .Order(new HistogramOrder { Count = SortOrder.Asc }) + .Order(AggregateOrder.KeyAscending) .Missing(DateTimeOffset.Parse("2015-06-06T12:01:02.1230000", styles: System.Globalization.DateTimeStyles.AssumeUniversal)) .Aggregations(childAggs => childAggs .Nested("project_tags", n => n @@ -86,7 +86,7 @@ public DateHistogramAggregationUsageTests(ReadOnlyCluster i, EndpointUsage usage // Minimum = FixedDate.AddYears(-1), // Maximum = FixedDate.AddYears(1), //}, - Order = new HistogramOrder { Count = SortOrder.Asc }, + Order = AggregateOrder.KeyAscending, Missing = DateTimeOffset.Parse("2015-06-06T12:01:02.1230000", styles: System.Globalization.DateTimeStyles.AssumeUniversal), Aggregations = new NestedAggregation("project_tags") {