diff --git a/src/Elastic.Clients.Elasticsearch/Serialization/Stringified.cs b/src/Elastic.Clients.Elasticsearch/Serialization/Stringified.cs index 9e13b8d8d69..5591f7e0cab 100644 --- a/src/Elastic.Clients.Elasticsearch/Serialization/Stringified.cs +++ b/src/Elastic.Clients.Elasticsearch/Serialization/Stringified.cs @@ -10,8 +10,15 @@ namespace Elastic.Clients.Elasticsearch; internal sealed class StringifiedLongConverter : JsonConverter { - public override long? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override long? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => ReadStringifiedLong(ref reader); + + public override void Write(Utf8JsonWriter writer, long? value, JsonSerializerOptions options) => writer.WriteNumberValue(value.Value); + + public static long ReadStringifiedLong(ref Utf8JsonReader reader) { + if (reader.TokenType == JsonTokenType.PropertyName) + reader.Read(); + if (reader.TokenType == JsonTokenType.String) { var longString = reader.GetString(); @@ -25,8 +32,6 @@ internal sealed class StringifiedLongConverter : JsonConverter } return reader.GetInt64(); - } - - public override void Write(Utf8JsonWriter writer, long? value, JsonSerializerOptions options) => writer.WriteNumberValue(value.Value); + } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AdjacencyMatrixAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AdjacencyMatrixAggregation.g.cs index f6e6af3b630..c4799c6c142 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AdjacencyMatrixAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AdjacencyMatrixAggregation.g.cs @@ -81,7 +81,6 @@ public override AdjacencyMatrixAggregation Read(ref Utf8JsonReader reader, Type } } - reader.Read(); return agg; } @@ -120,8 +119,6 @@ public AdjacencyMatrixAggregation(string name) : base(name) { } - [JsonInclude] - [JsonPropertyName("filters")] public Dictionary? Filters { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AutoDateHistogramAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AutoDateHistogramAggregation.g.cs index 0cc5126c25e..1dcb7d1a3c7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AutoDateHistogramAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AutoDateHistogramAggregation.g.cs @@ -177,7 +177,6 @@ public override AutoDateHistogramAggregation Read(ref Utf8JsonReader reader, Typ } } - reader.Read(); return agg; } @@ -264,40 +263,22 @@ public AutoDateHistogramAggregation(string name) : base(name) { } - [JsonInclude] - [JsonPropertyName("buckets")] public int? Buckets { get; set; } - [JsonInclude] - [JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } - [JsonInclude] - [JsonPropertyName("format")] public string? Format { get; set; } - [JsonInclude] - [JsonPropertyName("minimum_interval")] public Elastic.Clients.Elasticsearch.Aggregations.MinimumInterval? MinimumInterval { get; set; } - [JsonInclude] - [JsonPropertyName("missing")] public DateTimeOffset? Missing { get; set; } - [JsonInclude] - [JsonPropertyName("offset")] public string? Offset { get; set; } - [JsonInclude] - [JsonPropertyName("params")] public Dictionary? Params { get; set; } - [JsonInclude] - [JsonPropertyName("script")] public ScriptBase? Script { get; set; } - [JsonInclude] - [JsonPropertyName("time_zone")] public string? TimeZone { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AverageAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AverageAggregation.g.cs index 1d14fb546bd..ee70bac9b20 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AverageAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AverageAggregation.g.cs @@ -94,7 +94,6 @@ public override AverageAggregation Read(ref Utf8JsonReader reader, Type typeToCo } } - reader.Read(); return agg; } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BoxplotAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BoxplotAggregation.g.cs index a2961ddf8c5..4c89b09aa31 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BoxplotAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BoxplotAggregation.g.cs @@ -94,7 +94,6 @@ public override BoxplotAggregation Read(ref Utf8JsonReader reader, Type typeToCo } } - reader.Read(); return agg; } @@ -140,8 +139,6 @@ public BoxplotAggregation(string name) : base(name) { } - [JsonInclude] - [JsonPropertyName("compression")] public double? Compression { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CardinalityAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CardinalityAggregation.g.cs index 6cc2363cd93..cf6c6fa458b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CardinalityAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CardinalityAggregation.g.cs @@ -106,7 +106,6 @@ public override CardinalityAggregation Read(ref Utf8JsonReader reader, Type type } } - reader.Read(); return agg; } @@ -158,12 +157,8 @@ public CardinalityAggregation(string name) : base(name) { } - [JsonInclude] - [JsonPropertyName("precision_threshold")] public int? PrecisionThreshold { get; set; } - [JsonInclude] - [JsonPropertyName("rehash")] public bool? Rehash { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ChildrenAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ChildrenAggregation.g.cs index 1ecdde98df4..354a6129eb8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ChildrenAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ChildrenAggregation.g.cs @@ -81,7 +81,6 @@ public override ChildrenAggregation Read(ref Utf8JsonReader reader, Type typeToC } } - reader.Read(); return agg; } @@ -120,8 +119,6 @@ public ChildrenAggregation(string name) : base(name) { } - [JsonInclude] - [JsonPropertyName("type")] public string? Type { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CompositeAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CompositeAggregation.g.cs index bd312b585d6..92875720094 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CompositeAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CompositeAggregation.g.cs @@ -105,7 +105,6 @@ public override CompositeAggregation Read(ref Utf8JsonReader reader, Type typeTo } } - reader.Read(); return agg; } @@ -156,16 +155,10 @@ public CompositeAggregation(string name) : base(name) { } - [JsonInclude] - [JsonPropertyName("after")] public Dictionary? After { get; set; } - [JsonInclude] - [JsonPropertyName("size")] public int? Size { get; set; } - [JsonInclude] - [JsonPropertyName("sources")] public IEnumerable>? Sources { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CumulativeCardinalityAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CumulativeCardinalityAggregation.g.cs index c696b1dc5a8..ad016d7a388 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CumulativeCardinalityAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CumulativeCardinalityAggregation.g.cs @@ -94,7 +94,6 @@ public override CumulativeCardinalityAggregation Read(ref Utf8JsonReader reader, } } - reader.Read(); return agg; } 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 0a5b9caa0ce..ad629198e2a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DateHistogramAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DateHistogramAggregation.g.cs @@ -201,7 +201,6 @@ public override DateHistogramAggregation Read(ref Utf8JsonReader reader, Type ty } } - reader.Read(); return agg; } @@ -300,49 +299,27 @@ public DateHistogramAggregation(string name) : base(name) { } - [JsonInclude] - [JsonPropertyName("calendar_interval")] public Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval? CalendarInterval { get; set; } - [JsonInclude] - [JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } - [JsonInclude] - [JsonPropertyName("fixed_interval")] public Elastic.Clients.Elasticsearch.Duration? FixedInterval { get; set; } - [JsonInclude] - [JsonPropertyName("format")] public string? Format { get; set; } - [JsonInclude] - [JsonPropertyName("min_doc_count")] public int? MinDocCount { get; set; } - [JsonInclude] - [JsonPropertyName("missing")] public DateTimeOffset? Missing { get; set; } - [JsonInclude] - [JsonPropertyName("offset")] public Elastic.Clients.Elasticsearch.Duration? Offset { get; set; } - [JsonInclude] - [JsonPropertyName("order")] [JsonConverter(typeof(AggregateOrderConverter))] public IEnumerable>? Order { get; set; } - [JsonInclude] - [JsonPropertyName("params")] public Dictionary? Params { get; set; } - [JsonInclude] - [JsonPropertyName("script")] public ScriptBase? Script { get; set; } - [JsonInclude] - [JsonPropertyName("time_zone")] public string? TimeZone { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DateRangeAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DateRangeAggregation.g.cs index 5dd243642b8..2e710f1a088 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DateRangeAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DateRangeAggregation.g.cs @@ -117,7 +117,6 @@ public override DateRangeAggregation Read(ref Utf8JsonReader reader, Type typeTo } } - reader.Read(); return agg; } @@ -174,20 +173,12 @@ public DateRangeAggregation(string name) : base(name) { } - [JsonInclude] - [JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } - [JsonInclude] - [JsonPropertyName("format")] public string? Format { get; set; } - [JsonInclude] - [JsonPropertyName("ranges")] public IEnumerable? Ranges { get; set; } - [JsonInclude] - [JsonPropertyName("time_zone")] public string? TimeZone { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DerivativeAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DerivativeAggregation.g.cs index c6fee72c23f..2aa34caef38 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DerivativeAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DerivativeAggregation.g.cs @@ -94,7 +94,6 @@ public override DerivativeAggregation Read(ref Utf8JsonReader reader, Type typeT } } - reader.Read(); return agg; } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ExtendedStatsAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ExtendedStatsAggregation.g.cs index b9bab2b46b1..45d97c9ed99 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ExtendedStatsAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ExtendedStatsAggregation.g.cs @@ -106,7 +106,6 @@ public override ExtendedStatsAggregation Read(ref Utf8JsonReader reader, Type ty } } - reader.Read(); return agg; } @@ -158,8 +157,6 @@ public ExtendedStatsAggregation(string name) : base(name) { } - [JsonInclude] - [JsonPropertyName("sigma")] public double? Sigma { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ExtendedStatsBucketAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ExtendedStatsBucketAggregation.g.cs index bded8c7a948..29173e5cdd2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ExtendedStatsBucketAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ExtendedStatsBucketAggregation.g.cs @@ -106,7 +106,6 @@ public override ExtendedStatsBucketAggregation Read(ref Utf8JsonReader reader, T } } - reader.Read(); return agg; } @@ -157,8 +156,6 @@ public ExtendedStatsBucketAggregation(string name) : base(name) { } - [JsonInclude] - [JsonPropertyName("sigma")] public double? Sigma { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/FiltersAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/FiltersAggregation.g.cs index bc4f5dc40bd..56bcd6831c0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/FiltersAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/FiltersAggregation.g.cs @@ -105,7 +105,6 @@ public override FiltersAggregation Read(ref Utf8JsonReader reader, Type typeToCo } } - reader.Read(); return agg; } @@ -156,16 +155,10 @@ public FiltersAggregation(string name) : base(name) { } - [JsonInclude] - [JsonPropertyName("filters")] public Elastic.Clients.Elasticsearch.Aggregations.Buckets? Filters { get; set; } - [JsonInclude] - [JsonPropertyName("other_bucket")] public bool? OtherBucket { get; set; } - [JsonInclude] - [JsonPropertyName("other_bucket_key")] public string? OtherBucketKey { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GlobalAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GlobalAggregation.g.cs index 97f941c35cd..d3e33a1b560 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GlobalAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GlobalAggregation.g.cs @@ -70,7 +70,6 @@ public override GlobalAggregation Read(ref Utf8JsonReader reader, Type typeToCon } } - reader.Read(); return agg; } 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 1d49939a609..d2aa419a31b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/HistogramAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/HistogramAggregation.g.cs @@ -165,7 +165,6 @@ public override HistogramAggregation Read(ref Utf8JsonReader reader, Type typeTo } } - reader.Read(); return agg; } @@ -246,37 +245,21 @@ public HistogramAggregation(string name) : base(name) { } - [JsonInclude] - [JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } - [JsonInclude] - [JsonPropertyName("format")] public string? Format { get; set; } - [JsonInclude] - [JsonPropertyName("interval")] public double? Interval { get; set; } - [JsonInclude] - [JsonPropertyName("min_doc_count")] public int? MinDocCount { get; set; } - [JsonInclude] - [JsonPropertyName("missing")] public double? Missing { get; set; } - [JsonInclude] - [JsonPropertyName("offset")] public double? Offset { get; set; } - [JsonInclude] - [JsonPropertyName("order")] [JsonConverter(typeof(AggregateOrderConverter))] public IEnumerable>? Order { get; set; } - [JsonInclude] - [JsonPropertyName("script")] public ScriptBase? Script { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/InferenceAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/InferenceAggregate.g.cs index 76e75b87751..fe69c3982c6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/InferenceAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/InferenceAggregate.g.cs @@ -26,6 +26,10 @@ namespace Elastic.Clients.Elasticsearch.Aggregations { public partial class InferenceAggregate : AggregateBase { + [JsonInclude] + [JsonPropertyName("data")] + public Dictionary Data { get; init; } + [JsonInclude] [JsonPropertyName("feature_importance")] public IReadOnlyCollection? FeatureImportance { get; init; } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/InferenceAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/InferenceAggregation.g.cs index 99c6ec1a897..2773602f087 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/InferenceAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/InferenceAggregation.g.cs @@ -118,7 +118,6 @@ public override InferenceAggregation Read(ref Utf8JsonReader reader, Type typeTo } } - reader.Read(); return agg; } @@ -171,12 +170,8 @@ public InferenceAggregation(string name) : base(name) { } - [JsonInclude] - [JsonPropertyName("inference_config")] public Elastic.Clients.Elasticsearch.Aggregations.InferenceConfigContainer? InferenceConfig { get; set; } - [JsonInclude] - [JsonPropertyName("model_id")] public Elastic.Clients.Elasticsearch.Name ModelId { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/IpRangeAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/IpRangeAggregation.g.cs index 51081b80983..0be25bfeb18 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/IpRangeAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/IpRangeAggregation.g.cs @@ -93,7 +93,6 @@ public override IpRangeAggregation Read(ref Utf8JsonReader reader, Type typeToCo } } - reader.Read(); return agg; } @@ -138,12 +137,8 @@ public IpRangeAggregation(string name) : base(name) { } - [JsonInclude] - [JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } - [JsonInclude] - [JsonPropertyName("ranges")] public IEnumerable? Ranges { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MatrixStatsAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MatrixStatsAggregation.g.cs index b3a083a934f..c9e9ba95ed3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MatrixStatsAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MatrixStatsAggregation.g.cs @@ -94,7 +94,6 @@ public override MatrixStatsAggregation Read(ref Utf8JsonReader reader, Type type } } - reader.Read(); return agg; } @@ -139,8 +138,6 @@ public MatrixStatsAggregation(string name) : base(name) { } - [JsonInclude] - [JsonPropertyName("mode")] public Elastic.Clients.Elasticsearch.SortMode? Mode { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MaxAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MaxAggregation.g.cs index 2c29d297a78..e0b7f465633 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MaxAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MaxAggregation.g.cs @@ -94,7 +94,6 @@ public override MaxAggregation Read(ref Utf8JsonReader reader, Type typeToConver } } - reader.Read(); return agg; } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MedianAbsoluteDeviationAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MedianAbsoluteDeviationAggregation.g.cs index 567a936dfee..ffafa8156b1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MedianAbsoluteDeviationAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MedianAbsoluteDeviationAggregation.g.cs @@ -106,7 +106,6 @@ public override MedianAbsoluteDeviationAggregation Read(ref Utf8JsonReader reade } } - reader.Read(); return agg; } @@ -158,8 +157,6 @@ public MedianAbsoluteDeviationAggregation(string name) : base(name) { } - [JsonInclude] - [JsonPropertyName("compression")] public double? Compression { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MinAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MinAggregation.g.cs index a51f9770060..94537e844d0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MinAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MinAggregation.g.cs @@ -94,7 +94,6 @@ public override MinAggregation Read(ref Utf8JsonReader reader, Type typeToConver } } - reader.Read(); return agg; } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MissingAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MissingAggregation.g.cs index 5351d47a6dc..5074e80d18f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MissingAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MissingAggregation.g.cs @@ -81,7 +81,6 @@ public override MissingAggregation Read(ref Utf8JsonReader reader, Type typeToCo } } - reader.Read(); return agg; } @@ -120,8 +119,6 @@ public MissingAggregation(string name) : base(name) { } - [JsonInclude] - [JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MultiBucketBase.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MultiBucketBase.g.cs index 43ec375e1f7..a67902136f4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MultiBucketBase.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MultiBucketBase.g.cs @@ -26,6 +26,10 @@ namespace Elastic.Clients.Elasticsearch.Aggregations { public abstract partial class MultiBucketBase { + [JsonInclude] + [JsonPropertyName("aggregations")] + public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary Aggregations { get; init; } + [JsonInclude] [JsonPropertyName("doc_count")] public long DocCount { get; init; } 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 2e6d72bd9af..ae9169d8f2f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MultiTermsAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MultiTermsAggregation.g.cs @@ -165,7 +165,6 @@ public override MultiTermsAggregation Read(ref Utf8JsonReader reader, Type typeT } } - reader.Read(); return agg; } @@ -242,37 +241,21 @@ 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")] [JsonConverter(typeof(AggregateOrderConverter))] public IEnumerable>? 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; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/NestedAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/NestedAggregation.g.cs index d5bab2703d1..c10978fe1f8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/NestedAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/NestedAggregation.g.cs @@ -81,7 +81,6 @@ public override NestedAggregation Read(ref Utf8JsonReader reader, Type typeToCon } } - reader.Read(); return agg; } @@ -120,8 +119,6 @@ public NestedAggregation(string name) : base(name) { } - [JsonInclude] - [JsonPropertyName("path")] public Elastic.Clients.Elasticsearch.Field? Path { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ParentAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ParentAggregation.g.cs index 30935e431ea..99eb0715bd9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ParentAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ParentAggregation.g.cs @@ -81,7 +81,6 @@ public override ParentAggregation Read(ref Utf8JsonReader reader, Type typeToCon } } - reader.Read(); return agg; } @@ -120,8 +119,6 @@ public ParentAggregation(string name) : base(name) { } - [JsonInclude] - [JsonPropertyName("type")] public string? Type { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/PercentilesBucketAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/PercentilesBucketAggregation.g.cs index 3998c5c3c08..64f73093257 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/PercentilesBucketAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/PercentilesBucketAggregation.g.cs @@ -106,7 +106,6 @@ public override PercentilesBucketAggregation Read(ref Utf8JsonReader reader, Typ } } - reader.Read(); return agg; } @@ -157,8 +156,6 @@ public PercentilesBucketAggregation(string name) : base(name) { } - [JsonInclude] - [JsonPropertyName("percents")] public IEnumerable? Percents { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/RangeAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/RangeAggregation.g.cs index 241bd983ba5..a4a6051dfdd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/RangeAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/RangeAggregation.g.cs @@ -129,7 +129,6 @@ public override RangeAggregation Read(ref Utf8JsonReader reader, Type typeToConv } } - reader.Read(); return agg; } @@ -192,24 +191,14 @@ public RangeAggregation(string name) : base(name) { } - [JsonInclude] - [JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } - [JsonInclude] - [JsonPropertyName("format")] public string? Format { get; set; } - [JsonInclude] - [JsonPropertyName("missing")] public int? Missing { get; set; } - [JsonInclude] - [JsonPropertyName("ranges")] public IEnumerable? Ranges { get; set; } - [JsonInclude] - [JsonPropertyName("script")] public ScriptBase? Script { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/RateAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/RateAggregation.g.cs index 2a8a72b0025..654e1bbf1d2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/RateAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/RateAggregation.g.cs @@ -118,7 +118,6 @@ public override RateAggregation Read(ref Utf8JsonReader reader, Type typeToConve } } - reader.Read(); return agg; } @@ -176,12 +175,8 @@ public RateAggregation(string name) : base(name) { } - [JsonInclude] - [JsonPropertyName("mode")] public Elastic.Clients.Elasticsearch.Aggregations.RateMode? Mode { get; set; } - [JsonInclude] - [JsonPropertyName("unit")] public Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval? Unit { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ReverseNestedAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ReverseNestedAggregation.g.cs index 682fd29e8b9..77eb79b11ec 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ReverseNestedAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ReverseNestedAggregation.g.cs @@ -81,7 +81,6 @@ public override ReverseNestedAggregation Read(ref Utf8JsonReader reader, Type ty } } - reader.Read(); return agg; } @@ -120,8 +119,6 @@ public ReverseNestedAggregation(string name) : base(name) { } - [JsonInclude] - [JsonPropertyName("path")] public Elastic.Clients.Elasticsearch.Field? Path { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SamplerAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SamplerAggregation.g.cs index 612c314e5f6..997f6ff4d2c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SamplerAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SamplerAggregation.g.cs @@ -81,7 +81,6 @@ public override SamplerAggregation Read(ref Utf8JsonReader reader, Type typeToCo } } - reader.Read(); return agg; } @@ -120,8 +119,6 @@ public SamplerAggregation(string name) : base(name) { } - [JsonInclude] - [JsonPropertyName("shard_size")] public int? ShardSize { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ScriptedMetricAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ScriptedMetricAggregation.g.cs index 131446d405a..ded48607b14 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ScriptedMetricAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ScriptedMetricAggregation.g.cs @@ -142,7 +142,6 @@ public override ScriptedMetricAggregation Read(ref Utf8JsonReader reader, Type t } } - reader.Read(); return agg; } @@ -212,24 +211,14 @@ public ScriptedMetricAggregation(string name) : base(name) { } - [JsonInclude] - [JsonPropertyName("combine_script")] public ScriptBase? CombineScript { get; set; } - [JsonInclude] - [JsonPropertyName("init_script")] public ScriptBase? InitScript { get; set; } - [JsonInclude] - [JsonPropertyName("map_script")] public ScriptBase? MapScript { get; set; } - [JsonInclude] - [JsonPropertyName("params")] public Dictionary? Params { get; set; } - [JsonInclude] - [JsonPropertyName("reduce_script")] public ScriptBase? ReduceScript { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SingleBucketAggregateBase.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SingleBucketAggregateBase.g.cs index 8055e4fd1be..67b501d38b8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SingleBucketAggregateBase.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SingleBucketAggregateBase.g.cs @@ -26,6 +26,10 @@ namespace Elastic.Clients.Elasticsearch.Aggregations { public abstract partial class SingleBucketAggregateBase : AggregateBase { + [JsonInclude] + [JsonPropertyName("aggregations")] + public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary Aggregations { get; init; } + [JsonInclude] [JsonPropertyName("doc_count")] public long DocCount { get; init; } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StatsAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StatsAggregation.g.cs index 4999b6c6e82..41b5e00bec3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StatsAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StatsAggregation.g.cs @@ -94,7 +94,6 @@ public override StatsAggregation Read(ref Utf8JsonReader reader, Type typeToConv } } - reader.Read(); return agg; } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StatsBucketAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StatsBucketAggregation.g.cs index 2a698d03bb3..af79a6d3fd9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StatsBucketAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StatsBucketAggregation.g.cs @@ -94,7 +94,6 @@ public override StatsBucketAggregation Read(ref Utf8JsonReader reader, Type type } } - reader.Read(); return agg; } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StringStatsAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StringStatsAggregation.g.cs index 23f9a02381a..fa980d28f48 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StringStatsAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StringStatsAggregation.g.cs @@ -94,7 +94,6 @@ public override StringStatsAggregation Read(ref Utf8JsonReader reader, Type type } } - reader.Read(); return agg; } @@ -140,8 +139,6 @@ public StringStatsAggregation(string name) : base(name) { } - [JsonInclude] - [JsonPropertyName("show_distribution")] public bool? ShowDistribution { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SumAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SumAggregation.g.cs index 991038d579e..60a7a007155 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SumAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SumAggregation.g.cs @@ -94,7 +94,6 @@ public override SumAggregation Read(ref Utf8JsonReader reader, Type typeToConver } } - reader.Read(); return agg; } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TTestAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TTestAggregation.g.cs index af95ea53a9b..f9240363e8b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TTestAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TTestAggregation.g.cs @@ -94,7 +94,6 @@ public override TTestAggregation Read(ref Utf8JsonReader reader, Type typeToConv } } - reader.Read(); return agg; } @@ -139,16 +138,10 @@ public TTestAggregation(string name) : base(name) { } - [JsonInclude] - [JsonPropertyName("a")] public Elastic.Clients.Elasticsearch.Aggregations.TestPopulation? a { get; set; } - [JsonInclude] - [JsonPropertyName("b")] public Elastic.Clients.Elasticsearch.Aggregations.TestPopulation? b { get; set; } - [JsonInclude] - [JsonPropertyName("type")] public Elastic.Clients.Elasticsearch.Aggregations.TTestType? Type { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TermsAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TermsAggregation.g.cs index 47c8e6d48fb..7e9d130b9da 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TermsAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TermsAggregation.g.cs @@ -249,7 +249,6 @@ public override TermsAggregation Read(ref Utf8JsonReader reader, Type typeToConv } } - reader.Read(); return agg; } @@ -372,66 +371,36 @@ public TermsAggregation(string name) : base(name) { } - [JsonInclude] - [JsonPropertyName("collect_mode")] public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationCollectMode? CollectMode { get; set; } - [JsonInclude] - [JsonPropertyName("exclude")] [JsonConverter(typeof(TermsExcludeConverter))] public IEnumerable? Exclude { get; set; } - [JsonInclude] - [JsonPropertyName("execution_hint")] public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationExecutionHint? ExecutionHint { get; set; } - [JsonInclude] - [JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } - [JsonInclude] - [JsonPropertyName("format")] public string? Format { get; set; } - [JsonInclude] - [JsonPropertyName("include")] public Elastic.Clients.Elasticsearch.Aggregations.TermsInclude? Include { get; set; } - [JsonInclude] - [JsonPropertyName("min_doc_count")] public int? MinDocCount { get; set; } - [JsonInclude] - [JsonPropertyName("missing_bucket")] public bool? MissingBucket { get; set; } - [JsonInclude] - [JsonPropertyName("missing_order")] public Elastic.Clients.Elasticsearch.Aggregations.MissingOrder? MissingOrder { get; set; } - [JsonInclude] - [JsonPropertyName("order")] [JsonConverter(typeof(AggregateOrderConverter))] public IEnumerable>? Order { get; set; } - [JsonInclude] - [JsonPropertyName("script")] public ScriptBase? Script { 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("value_type")] public string? ValueType { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TopHitsAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TopHitsAggregation.g.cs index bcd4d944dd1..5d641c36268 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TopHitsAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TopHitsAggregation.g.cs @@ -226,7 +226,6 @@ public override TopHitsAggregation Read(ref Utf8JsonReader reader, Type typeToCo } } - reader.Read(); return agg; } @@ -338,53 +337,29 @@ public TopHitsAggregation(string name) : base(name) { } - [JsonInclude] - [JsonPropertyName("_source")] public Elastic.Clients.Elasticsearch.SourceConfig? Source { get; set; } - [JsonInclude] - [JsonPropertyName("docvalue_fields")] public Elastic.Clients.Elasticsearch.Fields? DocvalueFields { get; set; } - [JsonInclude] - [JsonPropertyName("explain")] public bool? Explain { get; set; } - [JsonInclude] - [JsonPropertyName("from")] public int? From { get; set; } - [JsonInclude] - [JsonPropertyName("highlight")] public Elastic.Clients.Elasticsearch.Highlight? Highlight { get; set; } - [JsonInclude] - [JsonPropertyName("script_fields")] public Dictionary? ScriptFields { get; set; } - [JsonInclude] - [JsonPropertyName("seq_no_primary_term")] public bool? SeqNoPrimaryTerm { get; set; } - [JsonInclude] - [JsonPropertyName("size")] public int? Size { get; set; } - [JsonInclude] - [JsonPropertyName("sort")] [JsonConverter(typeof(SortConverter))] public IEnumerable? Sort { get; set; } - [JsonInclude] - [JsonPropertyName("stored_fields")] public Elastic.Clients.Elasticsearch.Fields? StoredFields { get; set; } - [JsonInclude] - [JsonPropertyName("track_scores")] public bool? TrackScores { get; set; } - [JsonInclude] - [JsonPropertyName("version")] public bool? Version { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TopMetricsAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TopMetricsAggregation.g.cs index e926883a6ad..12fd53ceaf7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TopMetricsAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TopMetricsAggregation.g.cs @@ -118,7 +118,6 @@ public override TopMetricsAggregation Read(ref Utf8JsonReader reader, Type typeT } } - reader.Read(); return agg; } @@ -176,16 +175,10 @@ public TopMetricsAggregation(string name) : base(name) { } - [JsonInclude] - [JsonPropertyName("metrics")] public IEnumerable? Metrics { get; set; } - [JsonInclude] - [JsonPropertyName("size")] public int? Size { get; set; } - [JsonInclude] - [JsonPropertyName("sort")] [JsonConverter(typeof(SortConverter))] public IEnumerable? Sort { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ValueCountAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ValueCountAggregation.g.cs index f190afad101..b0aebeb100e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ValueCountAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ValueCountAggregation.g.cs @@ -94,7 +94,6 @@ public override ValueCountAggregation Read(ref Utf8JsonReader reader, Type typeT } } - reader.Read(); return agg; } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/VariableWidthHistogramAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/VariableWidthHistogramAggregation.g.cs index 9c24f934b2d..1fea89d894b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/VariableWidthHistogramAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/VariableWidthHistogramAggregation.g.cs @@ -106,7 +106,6 @@ public override VariableWidthHistogramAggregation Read(ref Utf8JsonReader reader } } - reader.Read(); return agg; } @@ -157,20 +156,12 @@ public VariableWidthHistogramAggregation(string name) : base(name) { } - [JsonInclude] - [JsonPropertyName("buckets")] public int? Buckets { get; set; } - [JsonInclude] - [JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } - [JsonInclude] - [JsonPropertyName("initial_buffer")] public int? InitialBuffer { get; set; } - [JsonInclude] - [JsonPropertyName("shard_size")] public int? ShardSize { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/WeightedAverageAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/WeightedAverageAggregation.g.cs index 87a43f527a5..b4874527f47 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/WeightedAverageAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/WeightedAverageAggregation.g.cs @@ -106,7 +106,6 @@ public override WeightedAverageAggregation Read(ref Utf8JsonReader reader, Type } } - reader.Read(); return agg; } @@ -157,20 +156,12 @@ public WeightedAverageAggregation(string name) : base(name) { } - [JsonInclude] - [JsonPropertyName("format")] public string? Format { get; set; } - [JsonInclude] - [JsonPropertyName("value")] public Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValue? Value { get; set; } - [JsonInclude] - [JsonPropertyName("value_type")] public Elastic.Clients.Elasticsearch.Aggregations.ValueType? ValueType { get; set; } - [JsonInclude] - [JsonPropertyName("weight")] public Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValue? Weight { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/CompletionContext.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/CompletionContext.g.cs new file mode 100644 index 00000000000..c085ff1b946 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/CompletionContext.g.cs @@ -0,0 +1,129 @@ +// 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 +{ + public partial class CompletionContext + { + [JsonInclude] + [JsonPropertyName("boost")] + public double? Boost { get; set; } + + [JsonInclude] + [JsonPropertyName("context")] + public Elastic.Clients.Elasticsearch.Context Context { get; set; } + + [JsonInclude] + [JsonPropertyName("neighbours")] + public IEnumerable? Neighbours { get; set; } + + [JsonInclude] + [JsonPropertyName("precision")] + public Elastic.Clients.Elasticsearch.GeoHashPrecision? Precision { get; set; } + + [JsonInclude] + [JsonPropertyName("prefix")] + public bool? Prefix { get; set; } + } + + public sealed partial class CompletionContextDescriptor : SerializableDescriptorBase + { + internal CompletionContextDescriptor(Action configure) => configure.Invoke(this); + public CompletionContextDescriptor() : base() + { + } + + private double? BoostValue { get; set; } + + private Elastic.Clients.Elasticsearch.Context ContextValue { get; set; } + + private IEnumerable? NeighboursValue { get; set; } + + private Elastic.Clients.Elasticsearch.GeoHashPrecision? PrecisionValue { get; set; } + + private bool? PrefixValue { get; set; } + + public CompletionContextDescriptor Boost(double? boost) + { + BoostValue = boost; + return Self; + } + + public CompletionContextDescriptor Context(Elastic.Clients.Elasticsearch.Context context) + { + ContextValue = context; + return Self; + } + + public CompletionContextDescriptor Neighbours(IEnumerable? neighbours) + { + NeighboursValue = neighbours; + return Self; + } + + public CompletionContextDescriptor Precision(Elastic.Clients.Elasticsearch.GeoHashPrecision? precision) + { + PrecisionValue = precision; + return Self; + } + + public CompletionContextDescriptor Prefix(bool? prefix = true) + { + PrefixValue = prefix; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (BoostValue.HasValue) + { + writer.WritePropertyName("boost"); + writer.WriteNumberValue(BoostValue.Value); + } + + writer.WritePropertyName("context"); + JsonSerializer.Serialize(writer, ContextValue, options); + if (NeighboursValue is not null) + { + writer.WritePropertyName("neighbours"); + JsonSerializer.Serialize(writer, NeighboursValue, options); + } + + if (PrecisionValue is not null) + { + writer.WritePropertyName("precision"); + JsonSerializer.Serialize(writer, PrecisionValue, options); + } + + if (PrefixValue.HasValue) + { + writer.WritePropertyName("prefix"); + writer.WriteBooleanValue(PrefixValue.Value); + } + + writer.WriteEndObject(); + } + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/CompletionSuggester.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/CompletionSuggester.g.cs new file mode 100644 index 00000000000..902f554381c --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/CompletionSuggester.g.cs @@ -0,0 +1,375 @@ +// 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 +{ + public partial class CompletionSuggester : SuggesterBase, IFieldSuggesterVariant + { + [JsonInclude] + [JsonPropertyName("contexts")] + public Dictionary>? Contexts { get; set; } + + [JsonInclude] + [JsonPropertyName("fuzzy")] + public Elastic.Clients.Elasticsearch.SuggestFuzziness? Fuzzy { get; set; } + + [JsonInclude] + [JsonPropertyName("prefix")] + public string? Prefix { get; set; } + + [JsonInclude] + [JsonPropertyName("regex")] + public string? Regex { get; set; } + + [JsonInclude] + [JsonPropertyName("skip_duplicates")] + public bool? SkipDuplicates { get; set; } + } + + public sealed partial class CompletionSuggesterDescriptor : SerializableDescriptorBase> + { + internal CompletionSuggesterDescriptor(Action> configure) => configure.Invoke(this); + public CompletionSuggesterDescriptor() : base() + { + } + + private string? AnalyzerValue { get; set; } + + private Dictionary>? ContextsValue { get; set; } + + private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } + + private Elastic.Clients.Elasticsearch.SuggestFuzziness? FuzzyValue { get; set; } + + private SuggestFuzzinessDescriptor FuzzyDescriptor { get; set; } + + private Action FuzzyDescriptorAction { get; set; } + + private string? PrefixValue { get; set; } + + private string? RegexValue { get; set; } + + private int? SizeValue { get; set; } + + private bool? SkipDuplicatesValue { get; set; } + + public CompletionSuggesterDescriptor Analyzer(string? analyzer) + { + AnalyzerValue = analyzer; + return Self; + } + + public CompletionSuggesterDescriptor Contexts(Func>, FluentDictionary>> selector) + { + ContextsValue = selector?.Invoke(new FluentDictionary>()); + return Self; + } + + public CompletionSuggesterDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + { + FieldValue = field; + return Self; + } + + public CompletionSuggesterDescriptor Field(Expression> field) + { + FieldValue = field; + return Self; + } + + public CompletionSuggesterDescriptor Fuzzy(Elastic.Clients.Elasticsearch.SuggestFuzziness? fuzzy) + { + FuzzyDescriptor = null; + FuzzyDescriptorAction = null; + FuzzyValue = fuzzy; + return Self; + } + + public CompletionSuggesterDescriptor Fuzzy(SuggestFuzzinessDescriptor descriptor) + { + FuzzyValue = null; + FuzzyDescriptorAction = null; + FuzzyDescriptor = descriptor; + return Self; + } + + public CompletionSuggesterDescriptor Fuzzy(Action configure) + { + FuzzyValue = null; + FuzzyDescriptor = null; + FuzzyDescriptorAction = configure; + return Self; + } + + public CompletionSuggesterDescriptor Prefix(string? prefix) + { + PrefixValue = prefix; + return Self; + } + + public CompletionSuggesterDescriptor Regex(string? regex) + { + RegexValue = regex; + return Self; + } + + public CompletionSuggesterDescriptor Size(int? size) + { + SizeValue = size; + return Self; + } + + public CompletionSuggesterDescriptor SkipDuplicates(bool? skipDuplicates = true) + { + SkipDuplicatesValue = skipDuplicates; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (!string.IsNullOrEmpty(AnalyzerValue)) + { + writer.WritePropertyName("analyzer"); + writer.WriteStringValue(AnalyzerValue); + } + + if (ContextsValue is not null) + { + writer.WritePropertyName("contexts"); + JsonSerializer.Serialize(writer, ContextsValue, options); + } + + writer.WritePropertyName("field"); + JsonSerializer.Serialize(writer, FieldValue, options); + if (FuzzyDescriptor is not null) + { + writer.WritePropertyName("fuzzy"); + JsonSerializer.Serialize(writer, FuzzyDescriptor, options); + } + else if (FuzzyDescriptorAction is not null) + { + writer.WritePropertyName("fuzzy"); + JsonSerializer.Serialize(writer, new SuggestFuzzinessDescriptor(FuzzyDescriptorAction), options); + } + else if (FuzzyValue is not null) + { + writer.WritePropertyName("fuzzy"); + JsonSerializer.Serialize(writer, FuzzyValue, options); + } + + if (!string.IsNullOrEmpty(PrefixValue)) + { + writer.WritePropertyName("prefix"); + writer.WriteStringValue(PrefixValue); + } + + if (!string.IsNullOrEmpty(RegexValue)) + { + writer.WritePropertyName("regex"); + writer.WriteStringValue(RegexValue); + } + + if (SizeValue.HasValue) + { + writer.WritePropertyName("size"); + writer.WriteNumberValue(SizeValue.Value); + } + + if (SkipDuplicatesValue.HasValue) + { + writer.WritePropertyName("skip_duplicates"); + writer.WriteBooleanValue(SkipDuplicatesValue.Value); + } + + writer.WriteEndObject(); + } + } + + public sealed partial class CompletionSuggesterDescriptor : SerializableDescriptorBase + { + internal CompletionSuggesterDescriptor(Action configure) => configure.Invoke(this); + public CompletionSuggesterDescriptor() : base() + { + } + + private string? AnalyzerValue { get; set; } + + private Dictionary>? ContextsValue { get; set; } + + private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } + + private Elastic.Clients.Elasticsearch.SuggestFuzziness? FuzzyValue { get; set; } + + private SuggestFuzzinessDescriptor FuzzyDescriptor { get; set; } + + private Action FuzzyDescriptorAction { get; set; } + + private string? PrefixValue { get; set; } + + private string? RegexValue { get; set; } + + private int? SizeValue { get; set; } + + private bool? SkipDuplicatesValue { get; set; } + + public CompletionSuggesterDescriptor Analyzer(string? analyzer) + { + AnalyzerValue = analyzer; + return Self; + } + + public CompletionSuggesterDescriptor Contexts(Func>, FluentDictionary>> selector) + { + ContextsValue = selector?.Invoke(new FluentDictionary>()); + return Self; + } + + public CompletionSuggesterDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + { + FieldValue = field; + return Self; + } + + public CompletionSuggesterDescriptor Field(Expression> field) + { + FieldValue = field; + return Self; + } + + public CompletionSuggesterDescriptor Field(Expression> field) + { + FieldValue = field; + return Self; + } + + public CompletionSuggesterDescriptor Fuzzy(Elastic.Clients.Elasticsearch.SuggestFuzziness? fuzzy) + { + FuzzyDescriptor = null; + FuzzyDescriptorAction = null; + FuzzyValue = fuzzy; + return Self; + } + + public CompletionSuggesterDescriptor Fuzzy(SuggestFuzzinessDescriptor descriptor) + { + FuzzyValue = null; + FuzzyDescriptorAction = null; + FuzzyDescriptor = descriptor; + return Self; + } + + public CompletionSuggesterDescriptor Fuzzy(Action configure) + { + FuzzyValue = null; + FuzzyDescriptor = null; + FuzzyDescriptorAction = configure; + return Self; + } + + public CompletionSuggesterDescriptor Prefix(string? prefix) + { + PrefixValue = prefix; + return Self; + } + + public CompletionSuggesterDescriptor Regex(string? regex) + { + RegexValue = regex; + return Self; + } + + public CompletionSuggesterDescriptor Size(int? size) + { + SizeValue = size; + return Self; + } + + public CompletionSuggesterDescriptor SkipDuplicates(bool? skipDuplicates = true) + { + SkipDuplicatesValue = skipDuplicates; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (!string.IsNullOrEmpty(AnalyzerValue)) + { + writer.WritePropertyName("analyzer"); + writer.WriteStringValue(AnalyzerValue); + } + + if (ContextsValue is not null) + { + writer.WritePropertyName("contexts"); + JsonSerializer.Serialize(writer, ContextsValue, options); + } + + writer.WritePropertyName("field"); + JsonSerializer.Serialize(writer, FieldValue, options); + if (FuzzyDescriptor is not null) + { + writer.WritePropertyName("fuzzy"); + JsonSerializer.Serialize(writer, FuzzyDescriptor, options); + } + else if (FuzzyDescriptorAction is not null) + { + writer.WritePropertyName("fuzzy"); + JsonSerializer.Serialize(writer, new SuggestFuzzinessDescriptor(FuzzyDescriptorAction), options); + } + else if (FuzzyValue is not null) + { + writer.WritePropertyName("fuzzy"); + JsonSerializer.Serialize(writer, FuzzyValue, options); + } + + if (!string.IsNullOrEmpty(PrefixValue)) + { + writer.WritePropertyName("prefix"); + writer.WriteStringValue(PrefixValue); + } + + if (!string.IsNullOrEmpty(RegexValue)) + { + writer.WritePropertyName("regex"); + writer.WriteStringValue(RegexValue); + } + + if (SizeValue.HasValue) + { + writer.WritePropertyName("size"); + writer.WriteNumberValue(SizeValue.Value); + } + + if (SkipDuplicatesValue.HasValue) + { + writer.WritePropertyName("skip_duplicates"); + writer.WriteBooleanValue(SkipDuplicatesValue.Value); + } + + writer.WriteEndObject(); + } + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Context.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Context.g.cs index 687f8a5c381..cb86a4deda3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Context.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Context.g.cs @@ -15,6 +15,7 @@ // // ------------------------------------------------ +using Elastic.Transport; using System; using System.Collections.Generic; using System.Linq.Expressions; @@ -24,14 +25,14 @@ #nullable restore namespace Elastic.Clients.Elasticsearch { - public partial class Context + public partial class Context : Union { - [JsonInclude] - [JsonPropertyName("methods")] - public IReadOnlyCollection Methods { get; init; } + public Context(string context) : base(context) + { + } - [JsonInclude] - [JsonPropertyName("name")] - public string Name { get; init; } + public Context(Elastic.Clients.Elasticsearch.GeoLocation geoLocation) : base(geoLocation) + { + } } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/DirectGenerator.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/DirectGenerator.g.cs new file mode 100644 index 00000000000..b91bc721a73 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/DirectGenerator.g.cs @@ -0,0 +1,419 @@ +// 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 +{ + public partial class DirectGenerator + { + [JsonInclude] + [JsonPropertyName("field")] + public Elastic.Clients.Elasticsearch.Field Field { get; set; } + + [JsonInclude] + [JsonPropertyName("max_edits")] + public int? MaxEdits { get; set; } + + [JsonInclude] + [JsonPropertyName("max_inspections")] + public float? MaxInspections { get; set; } + + [JsonInclude] + [JsonPropertyName("max_term_freq")] + public float? MaxTermFreq { get; set; } + + [JsonInclude] + [JsonPropertyName("min_doc_freq")] + public float? MinDocFreq { get; set; } + + [JsonInclude] + [JsonPropertyName("min_word_length")] + public int? MinWordLength { get; set; } + + [JsonInclude] + [JsonPropertyName("post_filter")] + public string? PostFilter { get; set; } + + [JsonInclude] + [JsonPropertyName("pre_filter")] + public string? PreFilter { get; set; } + + [JsonInclude] + [JsonPropertyName("prefix_length")] + public int? PrefixLength { get; set; } + + [JsonInclude] + [JsonPropertyName("size")] + public int? Size { get; set; } + + [JsonInclude] + [JsonPropertyName("suggest_mode")] + public Elastic.Clients.Elasticsearch.SuggestMode? SuggestMode { get; set; } + } + + public sealed partial class DirectGeneratorDescriptor : SerializableDescriptorBase> + { + internal DirectGeneratorDescriptor(Action> configure) => configure.Invoke(this); + public DirectGeneratorDescriptor() : base() + { + } + + private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } + + private int? MaxEditsValue { get; set; } + + private float? MaxInspectionsValue { get; set; } + + private float? MaxTermFreqValue { get; set; } + + private float? MinDocFreqValue { get; set; } + + private int? MinWordLengthValue { get; set; } + + private string? PostFilterValue { get; set; } + + private string? PreFilterValue { get; set; } + + private int? PrefixLengthValue { get; set; } + + private int? SizeValue { get; set; } + + private Elastic.Clients.Elasticsearch.SuggestMode? SuggestModeValue { get; set; } + + public DirectGeneratorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + { + FieldValue = field; + return Self; + } + + public DirectGeneratorDescriptor Field(Expression> field) + { + FieldValue = field; + return Self; + } + + public DirectGeneratorDescriptor MaxEdits(int? maxEdits) + { + MaxEditsValue = maxEdits; + return Self; + } + + public DirectGeneratorDescriptor MaxInspections(float? maxInspections) + { + MaxInspectionsValue = maxInspections; + return Self; + } + + public DirectGeneratorDescriptor MaxTermFreq(float? maxTermFreq) + { + MaxTermFreqValue = maxTermFreq; + return Self; + } + + public DirectGeneratorDescriptor MinDocFreq(float? minDocFreq) + { + MinDocFreqValue = minDocFreq; + return Self; + } + + public DirectGeneratorDescriptor MinWordLength(int? minWordLength) + { + MinWordLengthValue = minWordLength; + return Self; + } + + public DirectGeneratorDescriptor PostFilter(string? postFilter) + { + PostFilterValue = postFilter; + return Self; + } + + public DirectGeneratorDescriptor PreFilter(string? preFilter) + { + PreFilterValue = preFilter; + return Self; + } + + public DirectGeneratorDescriptor PrefixLength(int? prefixLength) + { + PrefixLengthValue = prefixLength; + return Self; + } + + public DirectGeneratorDescriptor Size(int? size) + { + SizeValue = size; + return Self; + } + + public DirectGeneratorDescriptor SuggestMode(Elastic.Clients.Elasticsearch.SuggestMode? suggestMode) + { + SuggestModeValue = suggestMode; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("field"); + JsonSerializer.Serialize(writer, FieldValue, options); + if (MaxEditsValue.HasValue) + { + writer.WritePropertyName("max_edits"); + writer.WriteNumberValue(MaxEditsValue.Value); + } + + if (MaxInspectionsValue.HasValue) + { + writer.WritePropertyName("max_inspections"); + writer.WriteNumberValue(MaxInspectionsValue.Value); + } + + if (MaxTermFreqValue.HasValue) + { + writer.WritePropertyName("max_term_freq"); + writer.WriteNumberValue(MaxTermFreqValue.Value); + } + + if (MinDocFreqValue.HasValue) + { + writer.WritePropertyName("min_doc_freq"); + writer.WriteNumberValue(MinDocFreqValue.Value); + } + + if (MinWordLengthValue.HasValue) + { + writer.WritePropertyName("min_word_length"); + writer.WriteNumberValue(MinWordLengthValue.Value); + } + + if (!string.IsNullOrEmpty(PostFilterValue)) + { + writer.WritePropertyName("post_filter"); + writer.WriteStringValue(PostFilterValue); + } + + if (!string.IsNullOrEmpty(PreFilterValue)) + { + writer.WritePropertyName("pre_filter"); + writer.WriteStringValue(PreFilterValue); + } + + if (PrefixLengthValue.HasValue) + { + writer.WritePropertyName("prefix_length"); + writer.WriteNumberValue(PrefixLengthValue.Value); + } + + if (SizeValue.HasValue) + { + writer.WritePropertyName("size"); + writer.WriteNumberValue(SizeValue.Value); + } + + if (SuggestModeValue is not null) + { + writer.WritePropertyName("suggest_mode"); + JsonSerializer.Serialize(writer, SuggestModeValue, options); + } + + writer.WriteEndObject(); + } + } + + public sealed partial class DirectGeneratorDescriptor : SerializableDescriptorBase + { + internal DirectGeneratorDescriptor(Action configure) => configure.Invoke(this); + public DirectGeneratorDescriptor() : base() + { + } + + private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } + + private int? MaxEditsValue { get; set; } + + private float? MaxInspectionsValue { get; set; } + + private float? MaxTermFreqValue { get; set; } + + private float? MinDocFreqValue { get; set; } + + private int? MinWordLengthValue { get; set; } + + private string? PostFilterValue { get; set; } + + private string? PreFilterValue { get; set; } + + private int? PrefixLengthValue { get; set; } + + private int? SizeValue { get; set; } + + private Elastic.Clients.Elasticsearch.SuggestMode? SuggestModeValue { get; set; } + + public DirectGeneratorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + { + FieldValue = field; + return Self; + } + + public DirectGeneratorDescriptor Field(Expression> field) + { + FieldValue = field; + return Self; + } + + public DirectGeneratorDescriptor Field(Expression> field) + { + FieldValue = field; + return Self; + } + + public DirectGeneratorDescriptor MaxEdits(int? maxEdits) + { + MaxEditsValue = maxEdits; + return Self; + } + + public DirectGeneratorDescriptor MaxInspections(float? maxInspections) + { + MaxInspectionsValue = maxInspections; + return Self; + } + + public DirectGeneratorDescriptor MaxTermFreq(float? maxTermFreq) + { + MaxTermFreqValue = maxTermFreq; + return Self; + } + + public DirectGeneratorDescriptor MinDocFreq(float? minDocFreq) + { + MinDocFreqValue = minDocFreq; + return Self; + } + + public DirectGeneratorDescriptor MinWordLength(int? minWordLength) + { + MinWordLengthValue = minWordLength; + return Self; + } + + public DirectGeneratorDescriptor PostFilter(string? postFilter) + { + PostFilterValue = postFilter; + return Self; + } + + public DirectGeneratorDescriptor PreFilter(string? preFilter) + { + PreFilterValue = preFilter; + return Self; + } + + public DirectGeneratorDescriptor PrefixLength(int? prefixLength) + { + PrefixLengthValue = prefixLength; + return Self; + } + + public DirectGeneratorDescriptor Size(int? size) + { + SizeValue = size; + return Self; + } + + public DirectGeneratorDescriptor SuggestMode(Elastic.Clients.Elasticsearch.SuggestMode? suggestMode) + { + SuggestModeValue = suggestMode; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("field"); + JsonSerializer.Serialize(writer, FieldValue, options); + if (MaxEditsValue.HasValue) + { + writer.WritePropertyName("max_edits"); + writer.WriteNumberValue(MaxEditsValue.Value); + } + + if (MaxInspectionsValue.HasValue) + { + writer.WritePropertyName("max_inspections"); + writer.WriteNumberValue(MaxInspectionsValue.Value); + } + + if (MaxTermFreqValue.HasValue) + { + writer.WritePropertyName("max_term_freq"); + writer.WriteNumberValue(MaxTermFreqValue.Value); + } + + if (MinDocFreqValue.HasValue) + { + writer.WritePropertyName("min_doc_freq"); + writer.WriteNumberValue(MinDocFreqValue.Value); + } + + if (MinWordLengthValue.HasValue) + { + writer.WritePropertyName("min_word_length"); + writer.WriteNumberValue(MinWordLengthValue.Value); + } + + if (!string.IsNullOrEmpty(PostFilterValue)) + { + writer.WritePropertyName("post_filter"); + writer.WriteStringValue(PostFilterValue); + } + + if (!string.IsNullOrEmpty(PreFilterValue)) + { + writer.WritePropertyName("pre_filter"); + writer.WriteStringValue(PreFilterValue); + } + + if (PrefixLengthValue.HasValue) + { + writer.WritePropertyName("prefix_length"); + writer.WriteNumberValue(PrefixLengthValue.Value); + } + + if (SizeValue.HasValue) + { + writer.WritePropertyName("size"); + writer.WriteNumberValue(SizeValue.Value); + } + + if (SuggestModeValue is not null) + { + writer.WritePropertyName("suggest_mode"); + JsonSerializer.Serialize(writer, SuggestModeValue, options); + } + + writer.WriteEndObject(); + } + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Ml.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Ml.g.cs index fb9f122dfb9..00494b103ea 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Ml.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Ml.g.cs @@ -486,6 +486,55 @@ public override void Write(Utf8JsonWriter writer, FilterType value, JsonSerializ } } + [JsonConverter(typeof(JobBlockedReasonConverter))] + public enum JobBlockedReason + { + [EnumMember(Value = "revert")] + Revert, + [EnumMember(Value = "reset")] + Reset, + [EnumMember(Value = "delete")] + Delete + } + + internal sealed class JobBlockedReasonConverter : JsonConverter + { + public override JobBlockedReason Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + var enumString = reader.GetString(); + switch (enumString) + { + case "revert": + return JobBlockedReason.Revert; + case "reset": + return JobBlockedReason.Reset; + case "delete": + return JobBlockedReason.Delete; + } + + ThrowHelper.ThrowJsonException(); + return default; + } + + public override void Write(Utf8JsonWriter writer, JobBlockedReason value, JsonSerializerOptions options) + { + switch (value) + { + case JobBlockedReason.Revert: + writer.WriteStringValue("revert"); + return; + case JobBlockedReason.Reset: + writer.WriteStringValue("reset"); + return; + case JobBlockedReason.Delete: + writer.WriteStringValue("delete"); + return; + } + + writer.WriteNullValue(); + } + } + [JsonConverter(typeof(JobStateConverter))] public enum JobState { diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.NoNamespace.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.NoNamespace.g.cs index b629e598469..a69918eb0a2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.NoNamespace.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.NoNamespace.g.cs @@ -1537,6 +1537,69 @@ public override void Write(Utf8JsonWriter writer, SortOrder value, JsonSerialize } } + [JsonConverter(typeof(StringDistanceConverter))] + public enum StringDistance + { + [EnumMember(Value = "ngram")] + Ngram, + [EnumMember(Value = "levenshtein")] + Levenshtein, + [EnumMember(Value = "jaro_winkler")] + JaroWinkler, + [EnumMember(Value = "internal")] + Internal, + [EnumMember(Value = "damerau_levenshtein")] + DamerauLevenshtein + } + + internal sealed class StringDistanceConverter : JsonConverter + { + public override StringDistance Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + var enumString = reader.GetString(); + switch (enumString) + { + case "ngram": + return StringDistance.Ngram; + case "levenshtein": + return StringDistance.Levenshtein; + case "jaro_winkler": + return StringDistance.JaroWinkler; + case "internal": + return StringDistance.Internal; + case "damerau_levenshtein": + return StringDistance.DamerauLevenshtein; + } + + ThrowHelper.ThrowJsonException(); + return default; + } + + public override void Write(Utf8JsonWriter writer, StringDistance value, JsonSerializerOptions options) + { + switch (value) + { + case StringDistance.Ngram: + writer.WriteStringValue("ngram"); + return; + case StringDistance.Levenshtein: + writer.WriteStringValue("levenshtein"); + return; + case StringDistance.JaroWinkler: + writer.WriteStringValue("jaro_winkler"); + return; + case StringDistance.Internal: + writer.WriteStringValue("internal"); + return; + case StringDistance.DamerauLevenshtein: + writer.WriteStringValue("damerau_levenshtein"); + return; + } + + writer.WriteNullValue(); + } + } + [JsonConverter(typeof(SuggestModeConverter))] public enum SuggestMode { @@ -1586,6 +1649,48 @@ public override void Write(Utf8JsonWriter writer, SuggestMode value, JsonSeriali } } + [JsonConverter(typeof(SuggestSortConverter))] + public enum SuggestSort + { + [EnumMember(Value = "score")] + Score, + [EnumMember(Value = "frequency")] + Frequency + } + + internal sealed class SuggestSortConverter : JsonConverter + { + public override SuggestSort Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + var enumString = reader.GetString(); + switch (enumString) + { + case "score": + return SuggestSort.Score; + case "frequency": + return SuggestSort.Frequency; + } + + ThrowHelper.ThrowJsonException(); + return default; + } + + public override void Write(Utf8JsonWriter writer, SuggestSort value, JsonSerializerOptions options) + { + switch (value) + { + case SuggestSort.Score: + writer.WriteStringValue("score"); + return; + case SuggestSort.Frequency: + writer.WriteStringValue("frequency"); + return; + } + + writer.WriteNullValue(); + } + } + [JsonConverter(typeof(ThreadTypeConverter))] public enum ThreadType { diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/ErrorCause.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/ErrorCause.g.cs index 020e54cd181..c78fbffe572 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/ErrorCause.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/ErrorCause.g.cs @@ -24,30 +24,90 @@ #nullable restore namespace Elastic.Clients.Elasticsearch { + internal sealed class ErrorCauseConverter : JsonConverter + { + public override ErrorCause Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + throw new JsonException("Unexpected JSON detected."); + Elastic.Clients.Elasticsearch.ErrorCause? causedBy = default; + string reason = default; + IReadOnlyCollection? rootCause = default; + string? stackTrace = default; + IReadOnlyCollection? suppressed = default; + string type = default; + Dictionary additionalProperties = null; + while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + { + if (reader.TokenType == JsonTokenType.PropertyName) + { + var property = reader.GetString(); + if (property == "caused_by") + { + causedBy = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "reason") + { + reason = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "root_cause") + { + rootCause = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (property == "stack_trace") + { + stackTrace = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "suppressed") + { + suppressed = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (property == "type") + { + type = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + additionalProperties ??= new Dictionary(); + var value = JsonSerializer.Deserialize(ref reader, options); + additionalProperties.Add(property, value); + } + } + + return new ErrorCause { CausedBy = causedBy, Reason = reason, RootCause = rootCause, StackTrace = stackTrace, Suppressed = suppressed, Type = type, Metadata = additionalProperties }; + } + + public override void Write(Utf8JsonWriter writer, ErrorCause value, JsonSerializerOptions options) + { + throw new NotImplementedException("'ErrorCause' is a readonly type, used only on responses and does not support being written to JSON."); + } + } + + [JsonConverter(typeof(ErrorCauseConverter))] public partial class ErrorCause { - [JsonInclude] - [JsonPropertyName("caused_by")] public Elastic.Clients.Elasticsearch.ErrorCause? CausedBy { get; init; } - [JsonInclude] - [JsonPropertyName("reason")] + public Dictionary Metadata { get; init; } + public string Reason { get; init; } - [JsonInclude] - [JsonPropertyName("root_cause")] public IReadOnlyCollection? RootCause { get; init; } - [JsonInclude] - [JsonPropertyName("stack_trace")] public string? StackTrace { get; init; } - [JsonInclude] - [JsonPropertyName("suppressed")] public IReadOnlyCollection? Suppressed { get; init; } - [JsonInclude] - [JsonPropertyName("type")] public string Type { get; init; } } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/FieldSuggester.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/FieldSuggester.g.cs new file mode 100644 index 00000000000..f8e6aebb4e9 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/FieldSuggester.g.cs @@ -0,0 +1,264 @@ +// 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 +{ + public interface IFieldSuggesterVariant + { + } + + [JsonConverter(typeof(FieldSuggesterConverter))] + public partial class FieldSuggester + { + public FieldSuggester(string variantName, IFieldSuggesterVariant variant) + { + if (variantName is null) + throw new ArgumentNullException(nameof(variantName)); + if (variant is null) + throw new ArgumentNullException(nameof(variant)); + if (string.IsNullOrWhiteSpace(variantName)) + throw new ArgumentException("Variant name must not be empty or whitespace."); + VariantName = variantName; + Variant = variant; + } + + internal IFieldSuggesterVariant Variant { get; } + + internal string VariantName { get; } + + public static FieldSuggester Completion(Elastic.Clients.Elasticsearch.CompletionSuggester completionSuggester) => new FieldSuggester("completion", completionSuggester); + public static FieldSuggester Phrase(Elastic.Clients.Elasticsearch.PhraseSuggester phraseSuggester) => new FieldSuggester("phrase", phraseSuggester); + public static FieldSuggester Term(Elastic.Clients.Elasticsearch.TermSuggester termSuggester) => new FieldSuggester("term", termSuggester); + [JsonInclude] + [JsonPropertyName("prefix")] + public string? Prefix { get; set; } + + [JsonInclude] + [JsonPropertyName("regex")] + public string? Regex { get; set; } + + [JsonInclude] + [JsonPropertyName("text")] + public string? Text { get; set; } + } + + internal sealed class FieldSuggesterConverter : JsonConverter + { + public override FieldSuggester Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + { + throw new JsonException("Expected start token."); + } + + reader.Read(); + if (reader.TokenType != JsonTokenType.PropertyName) + { + throw new JsonException("Expected property name token."); + } + + var propertyName = reader.GetString(); + reader.Read(); + if (propertyName == "completion") + { + var variant = JsonSerializer.Deserialize(ref reader, options); + reader.Read(); + return new FieldSuggester(propertyName, variant); + } + + if (propertyName == "phrase") + { + var variant = JsonSerializer.Deserialize(ref reader, options); + reader.Read(); + return new FieldSuggester(propertyName, variant); + } + + if (propertyName == "term") + { + var variant = JsonSerializer.Deserialize(ref reader, options); + reader.Read(); + return new FieldSuggester(propertyName, variant); + } + + throw new JsonException(); + } + + public override void Write(Utf8JsonWriter writer, FieldSuggester value, JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WritePropertyName(value.VariantName); + switch (value.VariantName) + { + case "completion": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.CompletionSuggester)value.Variant, options); + break; + case "phrase": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.PhraseSuggester)value.Variant, options); + break; + case "term": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.TermSuggester)value.Variant, options); + break; + } + + writer.WriteEndObject(); + } + } + + public sealed partial class FieldSuggesterDescriptor : SerializableDescriptorBase> + { + internal FieldSuggesterDescriptor(Action> configure) => configure.Invoke(this); + public FieldSuggesterDescriptor() : base() + { + } + + internal bool ContainsVariant { get; private set; } + + internal string ContainedVariantName { get; private set; } + + internal FieldSuggester Container { get; private set; } + + internal Descriptor Descriptor { get; private set; } + + internal Type DescriptorType { get; private set; } + + private void Set(Action descriptorAction, string variantName) + where T : Descriptor, new() + { + if (ContainsVariant) + throw new Exception("TODO"); + ContainedVariantName = variantName; + ContainsVariant = true; + DescriptorType = typeof(T); + var descriptor = new T(); + descriptorAction?.Invoke(descriptor); + Descriptor = descriptor; + } + + private void Set(IFieldSuggesterVariant variant, string variantName) + { + if (ContainsVariant) + throw new Exception("TODO"); + Container = new FieldSuggester(variantName, variant); + ContainedVariantName = variantName; + ContainsVariant = true; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + if (!ContainsVariant) + { + writer.WriteNullValue(); + return; + } + + if (Container is not null) + { + JsonSerializer.Serialize(writer, Container, options); + return; + } + + writer.WriteStartObject(); + writer.WritePropertyName(ContainedVariantName); + JsonSerializer.Serialize(writer, Descriptor, DescriptorType, options); + writer.WriteEndObject(); + } + + public void Completion(CompletionSuggester variant) => Set(variant, "completion"); + public void Completion(Action> configure) => Set(configure, "completion"); + public void Phrase(PhraseSuggester variant) => Set(variant, "phrase"); + public void Phrase(Action> configure) => Set(configure, "phrase"); + public void Term(TermSuggester variant) => Set(variant, "term"); + public void Term(Action> configure) => Set(configure, "term"); + } + + public sealed partial class FieldSuggesterDescriptor : SerializableDescriptorBase + { + internal FieldSuggesterDescriptor(Action configure) => configure.Invoke(this); + public FieldSuggesterDescriptor() : base() + { + } + + internal bool ContainsVariant { get; private set; } + + internal string ContainedVariantName { get; private set; } + + internal FieldSuggester Container { get; private set; } + + internal Descriptor Descriptor { get; private set; } + + internal Type DescriptorType { get; private set; } + + private void Set(Action descriptorAction, string variantName) + where T : Descriptor, new() + { + if (ContainsVariant) + throw new Exception("TODO"); + ContainedVariantName = variantName; + ContainsVariant = true; + DescriptorType = typeof(T); + var descriptor = new T(); + descriptorAction?.Invoke(descriptor); + Descriptor = descriptor; + } + + private void Set(IFieldSuggesterVariant variant, string variantName) + { + if (ContainsVariant) + throw new Exception("TODO"); + Container = new FieldSuggester(variantName, variant); + ContainedVariantName = variantName; + ContainsVariant = true; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + if (!ContainsVariant) + { + writer.WriteNullValue(); + return; + } + + if (Container is not null) + { + JsonSerializer.Serialize(writer, Container, options); + return; + } + + writer.WriteStartObject(); + writer.WritePropertyName(ContainedVariantName); + JsonSerializer.Serialize(writer, Descriptor, DescriptorType, options); + writer.WriteEndObject(); + } + + public void Completion(CompletionSuggester variant) => Set(variant, "completion"); + public void Completion(Action configure) => Set(configure, "completion"); + public void Completion(Action> configure) => Set(configure, "completion"); + public void Phrase(PhraseSuggester variant) => Set(variant, "phrase"); + public void Phrase(Action configure) => Set(configure, "phrase"); + public void Phrase(Action> configure) => Set(configure, "phrase"); + public void Term(TermSuggester variant) => Set(variant, "term"); + public void Term(Action configure) => Set(configure, "term"); + public void Term(Action> configure) => Set(configure, "term"); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeoDistanceSort.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeoDistanceSort.g.cs index 8977f6e7d13..7c644efcd38 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeoDistanceSort.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeoDistanceSort.g.cs @@ -72,7 +72,6 @@ public override GeoDistanceSort Read(ref Utf8JsonReader reader, Type typeToConve } } - reader.Read(); return variant; } @@ -128,32 +127,18 @@ public override void Write(Utf8JsonWriter writer, GeoDistanceSort value, JsonSer [JsonConverter(typeof(GeoDistanceSortConverter))] public partial class GeoDistanceSort : ISortOptionsVariant { - [JsonInclude] - [JsonPropertyName("distance_type")] public Elastic.Clients.Elasticsearch.GeoDistanceType? DistanceType { get; set; } - [JsonInclude] - [JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field Field { get; set; } - [JsonInclude] - [JsonPropertyName("ignore_unmapped")] public bool? IgnoreUnmapped { get; set; } - [JsonInclude] - [JsonPropertyName("location")] public IEnumerable Location { get; set; } - [JsonInclude] - [JsonPropertyName("mode")] public Elastic.Clients.Elasticsearch.SortMode? Mode { get; set; } - [JsonInclude] - [JsonPropertyName("order")] public Elastic.Clients.Elasticsearch.SortOrder? Order { get; set; } - [JsonInclude] - [JsonPropertyName("unit")] public Elastic.Clients.Elasticsearch.DistanceUnit? Unit { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeoHashPrecision.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeoHashPrecision.g.cs new file mode 100644 index 00000000000..ad5b8d7212e --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeoHashPrecision.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 +{ + public partial class GeoHashPrecision : Union + { + public GeoHashPrecision(double geoHashPrecision) : base(geoHashPrecision) + { + } + + public GeoHashPrecision(string geoHashPrecision) : base(geoHashPrecision) + { + } + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ExplainAnalyzeToken.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ExplainAnalyzeToken.g.cs index a1b3d9dd165..3d8022456c6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ExplainAnalyzeToken.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ExplainAnalyzeToken.g.cs @@ -24,42 +24,117 @@ #nullable restore namespace Elastic.Clients.Elasticsearch.IndexManagement { + internal sealed class ExplainAnalyzeTokenConverter : JsonConverter + { + public override ExplainAnalyzeToken Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + throw new JsonException("Unexpected JSON detected."); + string bytes = default; + long endOffset = default; + bool? keyword = default; + long position = default; + long positionlength = default; + long startOffset = default; + long termfrequency = default; + string token = default; + string type = default; + Dictionary additionalProperties = null; + while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + { + if (reader.TokenType == JsonTokenType.PropertyName) + { + var property = reader.GetString(); + if (property == "bytes") + { + bytes = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "end_offset") + { + endOffset = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "keyword") + { + keyword = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "position") + { + position = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "positionLength") + { + positionlength = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "start_offset") + { + startOffset = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "termFrequency") + { + termfrequency = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "token") + { + token = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "type") + { + type = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + additionalProperties ??= new Dictionary(); + var value = JsonSerializer.Deserialize(ref reader, options); + additionalProperties.Add(property, value); + } + } + + return new ExplainAnalyzeToken { Bytes = bytes, EndOffset = endOffset, Keyword = keyword, Position = position, Positionlength = positionlength, StartOffset = startOffset, Termfrequency = termfrequency, Token = token, Type = type, Attributes = additionalProperties }; + } + + public override void Write(Utf8JsonWriter writer, ExplainAnalyzeToken value, JsonSerializerOptions options) + { + throw new NotImplementedException("'ExplainAnalyzeToken' is a readonly type, used only on responses and does not support being written to JSON."); + } + } + + [JsonConverter(typeof(ExplainAnalyzeTokenConverter))] public partial class ExplainAnalyzeToken { - [JsonInclude] - [JsonPropertyName("bytes")] + public Dictionary Attributes { get; init; } + public string Bytes { get; init; } - [JsonInclude] - [JsonPropertyName("end_offset")] public long EndOffset { get; init; } - [JsonInclude] - [JsonPropertyName("keyword")] public bool? Keyword { get; init; } - [JsonInclude] - [JsonPropertyName("position")] public long Position { get; init; } - [JsonInclude] - [JsonPropertyName("positionLength")] public long Positionlength { get; init; } - [JsonInclude] - [JsonPropertyName("start_offset")] public long StartOffset { get; init; } - [JsonInclude] - [JsonPropertyName("termFrequency")] public long Termfrequency { get; init; } - [JsonInclude] - [JsonPropertyName("token")] public string Token { get; init; } - [JsonInclude] - [JsonPropertyName("type")] public string Type { get; init; } } } \ No newline at end of file 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 6ed1740eb38..5db13dceeb4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexSettings.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexSettings.g.cs @@ -24,235 +24,847 @@ #nullable restore namespace Elastic.Clients.Elasticsearch.IndexManagement { + internal sealed class IndexSettingsConverter : JsonConverter + { + public override IndexSettings Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + throw new JsonException("Unexpected JSON detected."); + var variant = new IndexSettings(); + Dictionary additionalProperties = null; + while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + { + if (reader.TokenType == JsonTokenType.PropertyName) + { + var property = reader.GetString(); + if (property == "analysis") + { + variant.Analysis = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "analyze") + { + variant.Analyze = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "auto_expand_replicas") + { + variant.AutoExpandReplicas = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "blocks") + { + variant.Blocks = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "check_on_startup") + { + variant.CheckOnStartup = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "codec") + { + variant.Codec = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "creation_date") + { + variant.CreationDate = StringifiedLongConverter.ReadStringifiedLong(ref reader); + continue; + } + + if (property == "creation_date_string") + { + variant.CreationDateString = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "default_pipeline") + { + variant.DefaultPipeline = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "final_pipeline") + { + variant.FinalPipeline = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "format") + { + variant.Format = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (property == "gc_deletes") + { + variant.GcDeletes = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "hidden") + { + variant.Hidden = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (property == "highlight") + { + variant.Highlight = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "index") + { + variant.Index = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "indexing_pressure") + { + variant.IndexingPressure = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "indexing.slowlog") + { + variant.IndexingSlowlog = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "lifecycle") + { + variant.Lifecycle = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "load_fixed_bitset_filters_eagerly") + { + variant.LoadFixedBitsetFiltersEagerly = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "mapping") + { + variant.Mapping = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "max_docvalue_fields_search") + { + variant.MaxDocvalueFieldsSearch = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "max_inner_result_window") + { + variant.MaxInnerResultWindow = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "max_ngram_diff") + { + variant.MaxNgramDiff = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "max_refresh_listeners") + { + variant.MaxRefreshListeners = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "max_regex_length") + { + variant.MaxRegexLength = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "max_rescore_window") + { + variant.MaxRescoreWindow = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "max_result_window") + { + variant.MaxResultWindow = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "max_script_fields") + { + variant.MaxScriptFields = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "max_shingle_diff") + { + variant.MaxShingleDiff = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "max_slices_per_scroll") + { + variant.MaxSlicesPerScroll = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "max_terms_count") + { + variant.MaxTermsCount = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "merge") + { + variant.Merge = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "mode") + { + variant.Mode = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "number_of_replicas") + { + variant.NumberOfReplicas = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (property == "number_of_routing_shards") + { + variant.NumberOfRoutingShards = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "number_of_shards") + { + variant.NumberOfShards = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (property == "priority") + { + variant.Priority = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (property == "provided_name") + { + variant.ProvidedName = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "queries") + { + variant.Queries = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "query_string") + { + variant.QueryString = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "refresh_interval") + { + variant.RefreshInterval = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "routing") + { + variant.Routing = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "routing_partition_size") + { + variant.RoutingPartitionSize = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "routing_path") + { + variant.RoutingPath = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (property == "search") + { + variant.Search = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "settings") + { + variant.Settings = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "shards") + { + variant.Shards = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "similarity") + { + variant.Similarity = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "soft_deletes") + { + variant.SoftDeletes = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "sort") + { + variant.Sort = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "store") + { + variant.Store = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "time_series") + { + variant.TimeSeries = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "top_metrics_max_size") + { + variant.TopMetricsMaxSize = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "translog") + { + variant.Translog = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "uuid") + { + variant.Uuid = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "verified_before_close") + { + variant.VerifiedBeforeClose = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (property == "version") + { + variant.Version = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + additionalProperties ??= new Dictionary(); + var value = JsonSerializer.Deserialize(ref reader, options); + additionalProperties.Add(property, value); + } + } + + variant.OtherSettings = additionalProperties; + return variant; + } + + public override void Write(Utf8JsonWriter writer, IndexSettings value, JsonSerializerOptions options) + { + writer.WriteStartObject(); + if (value.OtherSettings != null) + { + foreach (var additionalProperty in value.OtherSettings) + { + writer.WritePropertyName(additionalProperty.Key); + JsonSerializer.Serialize(writer, additionalProperty.Value, options); + } + } + + if (value.Analysis is not null) + { + writer.WritePropertyName("analysis"); + JsonSerializer.Serialize(writer, value.Analysis, options); + } + + if (value.Analyze is not null) + { + writer.WritePropertyName("analyze"); + JsonSerializer.Serialize(writer, value.Analyze, options); + } + + if (!string.IsNullOrEmpty(value.AutoExpandReplicas)) + { + writer.WritePropertyName("auto_expand_replicas"); + writer.WriteStringValue(value.AutoExpandReplicas); + } + + if (value.Blocks is not null) + { + writer.WritePropertyName("blocks"); + JsonSerializer.Serialize(writer, value.Blocks, options); + } + + if (value.CheckOnStartup is not null) + { + writer.WritePropertyName("check_on_startup"); + JsonSerializer.Serialize(writer, value.CheckOnStartup, options); + } + + if (!string.IsNullOrEmpty(value.Codec)) + { + writer.WritePropertyName("codec"); + writer.WriteStringValue(value.Codec); + } + + if (value.CreationDate is not null) + { + writer.WritePropertyName("creation_date"); + JsonSerializer.Serialize(writer, value.CreationDate, options); + } + + if (value.CreationDateString is not null) + { + writer.WritePropertyName("creation_date_string"); + JsonSerializer.Serialize(writer, value.CreationDateString, options); + } + + if (value.DefaultPipeline is not null) + { + writer.WritePropertyName("default_pipeline"); + JsonSerializer.Serialize(writer, value.DefaultPipeline, options); + } + + if (value.FinalPipeline is not null) + { + writer.WritePropertyName("final_pipeline"); + JsonSerializer.Serialize(writer, value.FinalPipeline, options); + } + + if (value.Format is not null) + { + writer.WritePropertyName("format"); + JsonSerializer.Serialize(writer, value.Format, options); + } + + if (value.GcDeletes is not null) + { + writer.WritePropertyName("gc_deletes"); + JsonSerializer.Serialize(writer, value.GcDeletes, options); + } + + if (value.Hidden is not null) + { + writer.WritePropertyName("hidden"); + JsonSerializer.Serialize(writer, value.Hidden, options); + } + + if (value.Highlight is not null) + { + writer.WritePropertyName("highlight"); + JsonSerializer.Serialize(writer, value.Highlight, options); + } + + if (value.Index is not null) + { + writer.WritePropertyName("index"); + JsonSerializer.Serialize(writer, value.Index, options); + } + + if (value.IndexingPressure is not null) + { + writer.WritePropertyName("indexing_pressure"); + JsonSerializer.Serialize(writer, value.IndexingPressure, options); + } + + if (value.IndexingSlowlog is not null) + { + writer.WritePropertyName("indexing.slowlog"); + JsonSerializer.Serialize(writer, value.IndexingSlowlog, options); + } + + if (value.Lifecycle is not null) + { + writer.WritePropertyName("lifecycle"); + JsonSerializer.Serialize(writer, value.Lifecycle, options); + } + + if (value.LoadFixedBitsetFiltersEagerly.HasValue) + { + writer.WritePropertyName("load_fixed_bitset_filters_eagerly"); + writer.WriteBooleanValue(value.LoadFixedBitsetFiltersEagerly.Value); + } + + if (value.Mapping is not null) + { + writer.WritePropertyName("mapping"); + JsonSerializer.Serialize(writer, value.Mapping, options); + } + + if (value.MaxDocvalueFieldsSearch.HasValue) + { + writer.WritePropertyName("max_docvalue_fields_search"); + writer.WriteNumberValue(value.MaxDocvalueFieldsSearch.Value); + } + + if (value.MaxInnerResultWindow.HasValue) + { + writer.WritePropertyName("max_inner_result_window"); + writer.WriteNumberValue(value.MaxInnerResultWindow.Value); + } + + if (value.MaxNgramDiff.HasValue) + { + writer.WritePropertyName("max_ngram_diff"); + writer.WriteNumberValue(value.MaxNgramDiff.Value); + } + + if (value.MaxRefreshListeners.HasValue) + { + writer.WritePropertyName("max_refresh_listeners"); + writer.WriteNumberValue(value.MaxRefreshListeners.Value); + } + + if (value.MaxRegexLength.HasValue) + { + writer.WritePropertyName("max_regex_length"); + writer.WriteNumberValue(value.MaxRegexLength.Value); + } + + if (value.MaxRescoreWindow.HasValue) + { + writer.WritePropertyName("max_rescore_window"); + writer.WriteNumberValue(value.MaxRescoreWindow.Value); + } + + if (value.MaxResultWindow.HasValue) + { + writer.WritePropertyName("max_result_window"); + writer.WriteNumberValue(value.MaxResultWindow.Value); + } + + if (value.MaxScriptFields.HasValue) + { + writer.WritePropertyName("max_script_fields"); + writer.WriteNumberValue(value.MaxScriptFields.Value); + } + + if (value.MaxShingleDiff.HasValue) + { + writer.WritePropertyName("max_shingle_diff"); + writer.WriteNumberValue(value.MaxShingleDiff.Value); + } + + if (value.MaxSlicesPerScroll.HasValue) + { + writer.WritePropertyName("max_slices_per_scroll"); + writer.WriteNumberValue(value.MaxSlicesPerScroll.Value); + } + + if (value.MaxTermsCount.HasValue) + { + writer.WritePropertyName("max_terms_count"); + writer.WriteNumberValue(value.MaxTermsCount.Value); + } + + if (value.Merge is not null) + { + writer.WritePropertyName("merge"); + JsonSerializer.Serialize(writer, value.Merge, options); + } + + if (!string.IsNullOrEmpty(value.Mode)) + { + writer.WritePropertyName("mode"); + writer.WriteStringValue(value.Mode); + } + + if (value.NumberOfReplicas is not null) + { + writer.WritePropertyName("number_of_replicas"); + JsonSerializer.Serialize(writer, value.NumberOfReplicas, options); + } + + if (value.NumberOfRoutingShards.HasValue) + { + writer.WritePropertyName("number_of_routing_shards"); + writer.WriteNumberValue(value.NumberOfRoutingShards.Value); + } + + if (value.NumberOfShards is not null) + { + writer.WritePropertyName("number_of_shards"); + JsonSerializer.Serialize(writer, value.NumberOfShards, options); + } + + if (value.Priority is not null) + { + writer.WritePropertyName("priority"); + JsonSerializer.Serialize(writer, value.Priority, options); + } + + if (value.ProvidedName is not null) + { + writer.WritePropertyName("provided_name"); + JsonSerializer.Serialize(writer, value.ProvidedName, options); + } + + if (value.Queries is not null) + { + writer.WritePropertyName("queries"); + JsonSerializer.Serialize(writer, value.Queries, options); + } + + if (value.QueryString is not null) + { + writer.WritePropertyName("query_string"); + JsonSerializer.Serialize(writer, value.QueryString, options); + } + + if (value.RefreshInterval is not null) + { + writer.WritePropertyName("refresh_interval"); + JsonSerializer.Serialize(writer, value.RefreshInterval, options); + } + + if (value.Routing is not null) + { + writer.WritePropertyName("routing"); + JsonSerializer.Serialize(writer, value.Routing, options); + } + + if (value.RoutingPartitionSize.HasValue) + { + writer.WritePropertyName("routing_partition_size"); + writer.WriteNumberValue(value.RoutingPartitionSize.Value); + } + + if (value.RoutingPath is not null) + { + writer.WritePropertyName("routing_path"); + JsonSerializer.Serialize(writer, value.RoutingPath, options); + } + + if (value.Search is not null) + { + writer.WritePropertyName("search"); + JsonSerializer.Serialize(writer, value.Search, options); + } + + if (value.Settings is not null) + { + writer.WritePropertyName("settings"); + JsonSerializer.Serialize(writer, value.Settings, options); + } + + if (value.Shards.HasValue) + { + writer.WritePropertyName("shards"); + writer.WriteNumberValue(value.Shards.Value); + } + + if (value.Similarity is not null) + { + writer.WritePropertyName("similarity"); + JsonSerializer.Serialize(writer, value.Similarity, options); + } + + if (value.SoftDeletes is not null) + { + writer.WritePropertyName("soft_deletes"); + JsonSerializer.Serialize(writer, value.SoftDeletes, options); + } + + if (value.Sort is not null) + { + writer.WritePropertyName("sort"); + JsonSerializer.Serialize(writer, value.Sort, options); + } + + if (value.Store is not null) + { + writer.WritePropertyName("store"); + JsonSerializer.Serialize(writer, value.Store, options); + } + + if (value.TimeSeries is not null) + { + writer.WritePropertyName("time_series"); + JsonSerializer.Serialize(writer, value.TimeSeries, options); + } + + if (value.TopMetricsMaxSize.HasValue) + { + writer.WritePropertyName("top_metrics_max_size"); + writer.WriteNumberValue(value.TopMetricsMaxSize.Value); + } + + if (value.Translog is not null) + { + writer.WritePropertyName("translog"); + JsonSerializer.Serialize(writer, value.Translog, options); + } + + if (value.Uuid is not null) + { + writer.WritePropertyName("uuid"); + JsonSerializer.Serialize(writer, value.Uuid, options); + } + + if (value.VerifiedBeforeClose is not null) + { + writer.WritePropertyName("verified_before_close"); + JsonSerializer.Serialize(writer, value.VerifiedBeforeClose, options); + } + + if (value.Version is not null) + { + writer.WritePropertyName("version"); + JsonSerializer.Serialize(writer, value.Version, options); + } + + writer.WriteEndObject(); + } + } + + [JsonConverter(typeof(IndexSettingsConverter))] public partial class IndexSettings { - [JsonInclude] - [JsonPropertyName("analysis")] public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsAnalysis? Analysis { get; set; } - [JsonInclude] - [JsonPropertyName("analyze")] public Elastic.Clients.Elasticsearch.IndexManagement.SettingsAnalyze? Analyze { get; set; } - [JsonInclude] - [JsonPropertyName("auto_expand_replicas")] public string? AutoExpandReplicas { get; set; } - [JsonInclude] - [JsonPropertyName("blocks")] public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingBlocks? Blocks { get; set; } - [JsonInclude] - [JsonPropertyName("check_on_startup")] public Elastic.Clients.Elasticsearch.IndexManagement.IndexCheckOnStartup? CheckOnStartup { get; set; } - [JsonInclude] - [JsonPropertyName("codec")] public string? Codec { get; set; } - [JsonInclude] - [JsonPropertyName("creation_date")] [JsonConverter(typeof(StringifiedLongConverter))] public long? CreationDate { get; set; } - [JsonInclude] - [JsonPropertyName("creation_date_string")] public DateTimeOffset? CreationDateString { get; set; } - [JsonInclude] - [JsonPropertyName("default_pipeline")] public string? DefaultPipeline { get; set; } - [JsonInclude] - [JsonPropertyName("final_pipeline")] public string? FinalPipeline { get; set; } - [JsonInclude] - [JsonPropertyName("format")] public Union? Format { get; set; } - [JsonInclude] - [JsonPropertyName("gc_deletes")] public Elastic.Clients.Elasticsearch.Duration? GcDeletes { get; set; } - [JsonInclude] - [JsonPropertyName("hidden")] public Union? Hidden { get; set; } - [JsonInclude] - [JsonPropertyName("highlight")] public Elastic.Clients.Elasticsearch.IndexManagement.SettingsHighlight? Highlight { get; set; } - [JsonInclude] - [JsonPropertyName("index")] public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? Index { get; set; } - [JsonInclude] - [JsonPropertyName("indexing_pressure")] public Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressure? IndexingPressure { get; set; } - [JsonInclude] - [JsonPropertyName("indexing.slowlog")] public Elastic.Clients.Elasticsearch.IndexManagement.SlowlogSettings? IndexingSlowlog { get; set; } - [JsonInclude] - [JsonPropertyName("lifecycle")] public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycle? Lifecycle { get; set; } - [JsonInclude] - [JsonPropertyName("load_fixed_bitset_filters_eagerly")] public bool? LoadFixedBitsetFiltersEagerly { get; set; } - [JsonInclude] - [JsonPropertyName("mapping")] public Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettings? Mapping { get; set; } - [JsonInclude] - [JsonPropertyName("max_docvalue_fields_search")] public int? MaxDocvalueFieldsSearch { get; set; } - [JsonInclude] - [JsonPropertyName("max_inner_result_window")] public int? MaxInnerResultWindow { get; set; } - [JsonInclude] - [JsonPropertyName("max_ngram_diff")] public int? MaxNgramDiff { get; set; } - [JsonInclude] - [JsonPropertyName("max_refresh_listeners")] public int? MaxRefreshListeners { get; set; } - [JsonInclude] - [JsonPropertyName("max_regex_length")] public int? MaxRegexLength { get; set; } - [JsonInclude] - [JsonPropertyName("max_rescore_window")] public int? MaxRescoreWindow { get; set; } - [JsonInclude] - [JsonPropertyName("max_result_window")] public int? MaxResultWindow { get; set; } - [JsonInclude] - [JsonPropertyName("max_script_fields")] public int? MaxScriptFields { get; set; } - [JsonInclude] - [JsonPropertyName("max_shingle_diff")] public int? MaxShingleDiff { get; set; } - [JsonInclude] - [JsonPropertyName("max_slices_per_scroll")] public int? MaxSlicesPerScroll { get; set; } - [JsonInclude] - [JsonPropertyName("max_terms_count")] public int? MaxTermsCount { get; set; } - [JsonInclude] - [JsonPropertyName("merge")] public Elastic.Clients.Elasticsearch.IndexManagement.Merge? Merge { get; set; } - [JsonInclude] - [JsonPropertyName("mode")] public string? Mode { get; set; } - [JsonInclude] - [JsonPropertyName("number_of_replicas")] public Union? NumberOfReplicas { get; set; } - [JsonInclude] - [JsonPropertyName("number_of_routing_shards")] public int? NumberOfRoutingShards { get; set; } - [JsonInclude] - [JsonPropertyName("number_of_shards")] public Union? NumberOfShards { get; set; } - [JsonInclude] - [JsonPropertyName("priority")] + public Dictionary OtherSettings { get; set; } + public Union? Priority { get; set; } - [JsonInclude] - [JsonPropertyName("provided_name")] public Elastic.Clients.Elasticsearch.Name? ProvidedName { get; set; } - [JsonInclude] - [JsonPropertyName("queries")] public Elastic.Clients.Elasticsearch.IndexManagement.Queries? Queries { get; set; } - [JsonInclude] - [JsonPropertyName("query_string")] public Elastic.Clients.Elasticsearch.IndexManagement.SettingsQueryString? QueryString { get; set; } - [JsonInclude] - [JsonPropertyName("refresh_interval")] public Elastic.Clients.Elasticsearch.Duration? RefreshInterval { get; set; } - [JsonInclude] - [JsonPropertyName("routing")] public Elastic.Clients.Elasticsearch.IndexManagement.IndexRouting? Routing { get; set; } - [JsonInclude] - [JsonPropertyName("routing_partition_size")] public int? RoutingPartitionSize { get; set; } - [JsonInclude] - [JsonPropertyName("routing_path")] public IEnumerable? RoutingPath { get; set; } - [JsonInclude] - [JsonPropertyName("search")] public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSearch? Search { get; set; } - [JsonInclude] - [JsonPropertyName("settings")] public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? Settings { get; set; } - [JsonInclude] - [JsonPropertyName("shards")] public int? Shards { get; set; } - [JsonInclude] - [JsonPropertyName("similarity")] public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarity? Similarity { get; set; } - [JsonInclude] - [JsonPropertyName("soft_deletes")] public Elastic.Clients.Elasticsearch.IndexManagement.SoftDeletes? SoftDeletes { get; set; } - [JsonInclude] - [JsonPropertyName("sort")] public Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSort? Sort { get; set; } - [JsonInclude] - [JsonPropertyName("store")] public Elastic.Clients.Elasticsearch.IndexManagement.Storage? Store { get; set; } - [JsonInclude] - [JsonPropertyName("time_series")] public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsTimeSeries? TimeSeries { get; set; } - [JsonInclude] - [JsonPropertyName("top_metrics_max_size")] public int? TopMetricsMaxSize { get; set; } - [JsonInclude] - [JsonPropertyName("translog")] public Elastic.Clients.Elasticsearch.IndexManagement.Translog? Translog { get; set; } - [JsonInclude] - [JsonPropertyName("uuid")] public string? Uuid { get; set; } - [JsonInclude] - [JsonPropertyName("verified_before_close")] public Union? VerifiedBeforeClose { get; set; } - [JsonInclude] - [JsonPropertyName("version")] public Elastic.Clients.Elasticsearch.IndexManagement.IndexVersioning? Version { get; set; } } @@ -387,6 +999,8 @@ public IndexSettingsDescriptor() : base() private Union? NumberOfShardsValue { get; set; } + private Dictionary OtherSettingsValue { get; set; } + private Union? PriorityValue { get; set; } private Elastic.Clients.Elasticsearch.Name? ProvidedNameValue { get; set; } @@ -909,6 +1523,12 @@ public IndexSettingsDescriptor NumberOfShards(Union? n return Self; } + public IndexSettingsDescriptor OtherSettings(Func, FluentDictionary> selector) + { + OtherSettingsValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + public IndexSettingsDescriptor Priority(Union? priority) { PriorityValue = priority; @@ -1768,6 +2388,15 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o JsonSerializer.Serialize(writer, VersionValue, options); } + if (OtherSettingsValue != null) + { + foreach (var additionalProperty in OtherSettingsValue) + { + writer.WritePropertyName(additionalProperty.Key); + JsonSerializer.Serialize(writer, additionalProperty.Value, options); + } + } + writer.WriteEndObject(); } } @@ -1903,6 +2532,8 @@ public IndexSettingsDescriptor() : base() private Union? NumberOfShardsValue { get; set; } + private Dictionary OtherSettingsValue { get; set; } + private Union? PriorityValue { get; set; } private Elastic.Clients.Elasticsearch.Name? ProvidedNameValue { get; set; } @@ -2425,6 +3056,12 @@ public IndexSettingsDescriptor NumberOfShards(Union? numberOfShar return Self; } + public IndexSettingsDescriptor OtherSettings(Func, FluentDictionary> selector) + { + OtherSettingsValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + public IndexSettingsDescriptor Priority(Union? priority) { PriorityValue = priority; @@ -3284,6 +3921,15 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o JsonSerializer.Serialize(writer, VersionValue, options); } + if (OtherSettingsValue != null) + { + foreach (var additionalProperty in OtherSettingsValue) + { + writer.WritePropertyName(additionalProperty.Key); + JsonSerializer.Serialize(writer, additionalProperty.Value, options); + } + } + writer.WriteEndObject(); } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/InlineGet.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/InlineGet.g.cs index 984a716109e..68ebd5ab4c2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/InlineGet.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/InlineGet.g.cs @@ -50,5 +50,9 @@ public partial class InlineGet [JsonInclude] [JsonPropertyName("found")] public bool Found { get; init; } + + [JsonInclude] + [JsonPropertyName("metadata")] + public Dictionary Metadata { get; init; } } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/LaplaceSmoothingModel.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/LaplaceSmoothingModel.g.cs new file mode 100644 index 00000000000..f178539abe5 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/LaplaceSmoothingModel.g.cs @@ -0,0 +1,57 @@ +// 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 +{ + public partial class LaplaceSmoothingModel : ISmoothingModelVariant + { + [JsonInclude] + [JsonPropertyName("alpha")] + public double Alpha { get; set; } + } + + public sealed partial class LaplaceSmoothingModelDescriptor : SerializableDescriptorBase + { + internal LaplaceSmoothingModelDescriptor(Action configure) => configure.Invoke(this); + public LaplaceSmoothingModelDescriptor() : base() + { + } + + private double AlphaValue { get; set; } + + public LaplaceSmoothingModelDescriptor Alpha(double alpha) + { + AlphaValue = alpha; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("alpha"); + writer.WriteNumberValue(AlphaValue); + writer.WriteEndObject(); + } + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/LinearInterpolationSmoothingModel.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/LinearInterpolationSmoothingModel.g.cs new file mode 100644 index 00000000000..9c3839723cc --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/LinearInterpolationSmoothingModel.g.cs @@ -0,0 +1,85 @@ +// 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 +{ + public partial class LinearInterpolationSmoothingModel : ISmoothingModelVariant + { + [JsonInclude] + [JsonPropertyName("bigram_lambda")] + public double BigramLambda { get; set; } + + [JsonInclude] + [JsonPropertyName("trigram_lambda")] + public double TrigramLambda { get; set; } + + [JsonInclude] + [JsonPropertyName("unigram_lambda")] + public double UnigramLambda { get; set; } + } + + public sealed partial class LinearInterpolationSmoothingModelDescriptor : SerializableDescriptorBase + { + internal LinearInterpolationSmoothingModelDescriptor(Action configure) => configure.Invoke(this); + public LinearInterpolationSmoothingModelDescriptor() : base() + { + } + + private double BigramLambdaValue { get; set; } + + private double TrigramLambdaValue { get; set; } + + private double UnigramLambdaValue { get; set; } + + public LinearInterpolationSmoothingModelDescriptor BigramLambda(double bigramLambda) + { + BigramLambdaValue = bigramLambda; + return Self; + } + + public LinearInterpolationSmoothingModelDescriptor TrigramLambda(double trigramLambda) + { + TrigramLambdaValue = trigramLambda; + return Self; + } + + public LinearInterpolationSmoothingModelDescriptor UnigramLambda(double unigramLambda) + { + UnigramLambdaValue = unigramLambda; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("bigram_lambda"); + writer.WriteNumberValue(BigramLambdaValue); + writer.WritePropertyName("trigram_lambda"); + writer.WriteNumberValue(TrigramLambdaValue); + writer.WritePropertyName("unigram_lambda"); + writer.WriteNumberValue(UnigramLambdaValue); + writer.WriteEndObject(); + } + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ml/Job.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ml/Job.g.cs new file mode 100644 index 00000000000..21e9636d2c2 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ml/Job.g.cs @@ -0,0 +1,121 @@ +// 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.Ml +{ + public partial class Job + { + [JsonInclude] + [JsonPropertyName("allow_lazy_open")] + public bool AllowLazyOpen { get; init; } + + [JsonInclude] + [JsonPropertyName("analysis_config")] + public Elastic.Clients.Elasticsearch.Ml.AnalysisConfig AnalysisConfig { get; init; } + + [JsonInclude] + [JsonPropertyName("analysis_limits")] + public Elastic.Clients.Elasticsearch.Ml.AnalysisLimits? AnalysisLimits { get; init; } + + [JsonInclude] + [JsonPropertyName("background_persist_interval")] + public Elastic.Clients.Elasticsearch.Duration? BackgroundPersistInterval { get; init; } + + [JsonInclude] + [JsonPropertyName("blocked")] + public Elastic.Clients.Elasticsearch.Ml.JobBlocked? Blocked { get; init; } + + [JsonInclude] + [JsonPropertyName("create_time")] + public DateTimeOffset? CreateTime { get; init; } + + [JsonInclude] + [JsonPropertyName("custom_settings")] + public object? CustomSettings { get; init; } + + [JsonInclude] + [JsonPropertyName("daily_model_snapshot_retention_after_days")] + public long? DailyModelSnapshotRetentionAfterDays { get; init; } + + [JsonInclude] + [JsonPropertyName("data_description")] + public Elastic.Clients.Elasticsearch.Ml.DataDescription DataDescription { get; init; } + + [JsonInclude] + [JsonPropertyName("datafeed_config")] + public Elastic.Clients.Elasticsearch.Ml.Datafeed? DatafeedConfig { get; init; } + + [JsonInclude] + [JsonPropertyName("deleting")] + public bool? Deleting { get; init; } + + [JsonInclude] + [JsonPropertyName("description")] + public string? Description { get; init; } + + [JsonInclude] + [JsonPropertyName("finished_time")] + public DateTimeOffset? FinishedTime { get; init; } + + [JsonInclude] + [JsonPropertyName("groups")] + public IReadOnlyCollection? Groups { get; init; } + + [JsonInclude] + [JsonPropertyName("job_id")] + public string JobId { get; init; } + + [JsonInclude] + [JsonPropertyName("job_type")] + public string? JobType { get; init; } + + [JsonInclude] + [JsonPropertyName("job_version")] + public string? JobVersion { get; init; } + + [JsonInclude] + [JsonPropertyName("model_plot_config")] + public Elastic.Clients.Elasticsearch.Ml.ModelPlotConfig? ModelPlotConfig { get; init; } + + [JsonInclude] + [JsonPropertyName("model_snapshot_id")] + public string? ModelSnapshotId { get; init; } + + [JsonInclude] + [JsonPropertyName("model_snapshot_retention_days")] + public long ModelSnapshotRetentionDays { get; init; } + + [JsonInclude] + [JsonPropertyName("renormalization_window_days")] + public long? RenormalizationWindowDays { get; init; } + + [JsonInclude] + [JsonPropertyName("results_index_name")] + public string ResultsIndexName { get; init; } + + [JsonInclude] + [JsonPropertyName("results_retention_days")] + public long? ResultsRetentionDays { get; init; } + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ml/JobBlocked.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ml/JobBlocked.g.cs new file mode 100644 index 00000000000..d781c3c5292 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ml/JobBlocked.g.cs @@ -0,0 +1,37 @@ +// 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.Ml +{ + public partial class JobBlocked + { + [JsonInclude] + [JsonPropertyName("reason")] + public Elastic.Clients.Elasticsearch.Ml.JobBlockedReason Reason { get; init; } + + [JsonInclude] + [JsonPropertyName("task_id")] + public Elastic.Clients.Elasticsearch.TaskId? TaskId { get; init; } + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/PhraseSuggestCollate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/PhraseSuggestCollate.g.cs new file mode 100644 index 00000000000..8e18636e8a1 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/PhraseSuggestCollate.g.cs @@ -0,0 +1,129 @@ +// 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 +{ + public partial class PhraseSuggestCollate + { + [JsonInclude] + [JsonPropertyName("params")] + public Dictionary? Params { get; set; } + + [JsonInclude] + [JsonPropertyName("prune")] + public bool? Prune { get; set; } + + [JsonInclude] + [JsonPropertyName("query")] + public Elastic.Clients.Elasticsearch.PhraseSuggestCollateQuery Query { get; set; } + } + + public sealed partial class PhraseSuggestCollateDescriptor : SerializableDescriptorBase + { + internal PhraseSuggestCollateDescriptor(Action configure) => configure.Invoke(this); + public PhraseSuggestCollateDescriptor() : base() + { + } + + private Dictionary? ParamsValue { get; set; } + + private bool? PruneValue { get; set; } + + private Elastic.Clients.Elasticsearch.PhraseSuggestCollateQuery QueryValue { get; set; } + + private PhraseSuggestCollateQueryDescriptor QueryDescriptor { get; set; } + + private Action QueryDescriptorAction { get; set; } + + public PhraseSuggestCollateDescriptor Params(Func, FluentDictionary> selector) + { + ParamsValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + public PhraseSuggestCollateDescriptor Prune(bool? prune = true) + { + PruneValue = prune; + return Self; + } + + public PhraseSuggestCollateDescriptor Query(Elastic.Clients.Elasticsearch.PhraseSuggestCollateQuery query) + { + QueryDescriptor = null; + QueryDescriptorAction = null; + QueryValue = query; + return Self; + } + + public PhraseSuggestCollateDescriptor Query(PhraseSuggestCollateQueryDescriptor descriptor) + { + QueryValue = null; + QueryDescriptorAction = null; + QueryDescriptor = descriptor; + return Self; + } + + public PhraseSuggestCollateDescriptor Query(Action configure) + { + QueryValue = null; + QueryDescriptor = null; + QueryDescriptorAction = configure; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (ParamsValue is not null) + { + writer.WritePropertyName("params"); + JsonSerializer.Serialize(writer, ParamsValue, options); + } + + if (PruneValue.HasValue) + { + writer.WritePropertyName("prune"); + writer.WriteBooleanValue(PruneValue.Value); + } + + if (QueryDescriptor is not null) + { + writer.WritePropertyName("query"); + JsonSerializer.Serialize(writer, QueryDescriptor, options); + } + else if (QueryDescriptorAction is not null) + { + writer.WritePropertyName("query"); + JsonSerializer.Serialize(writer, new PhraseSuggestCollateQueryDescriptor(QueryDescriptorAction), options); + } + else + { + writer.WritePropertyName("query"); + JsonSerializer.Serialize(writer, QueryValue, options); + } + + writer.WriteEndObject(); + } + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/PhraseSuggestCollateQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/PhraseSuggestCollateQuery.g.cs new file mode 100644 index 00000000000..8a7db981cf2 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/PhraseSuggestCollateQuery.g.cs @@ -0,0 +1,79 @@ +// 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 +{ + public partial class PhraseSuggestCollateQuery + { + [JsonInclude] + [JsonPropertyName("id")] + public Elastic.Clients.Elasticsearch.Id? Id { get; set; } + + [JsonInclude] + [JsonPropertyName("source")] + public string? Source { get; set; } + } + + public sealed partial class PhraseSuggestCollateQueryDescriptor : SerializableDescriptorBase + { + internal PhraseSuggestCollateQueryDescriptor(Action configure) => configure.Invoke(this); + public PhraseSuggestCollateQueryDescriptor() : base() + { + } + + private Elastic.Clients.Elasticsearch.Id? IdValue { get; set; } + + private string? SourceValue { get; set; } + + public PhraseSuggestCollateQueryDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) + { + IdValue = id; + return Self; + } + + public PhraseSuggestCollateQueryDescriptor Source(string? source) + { + SourceValue = source; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (IdValue is not null) + { + writer.WritePropertyName("id"); + JsonSerializer.Serialize(writer, IdValue, options); + } + + if (!string.IsNullOrEmpty(SourceValue)) + { + writer.WritePropertyName("source"); + writer.WriteStringValue(SourceValue); + } + + writer.WriteEndObject(); + } + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/PhraseSuggestHighlight.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/PhraseSuggestHighlight.g.cs new file mode 100644 index 00000000000..b608abf2064 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/PhraseSuggestHighlight.g.cs @@ -0,0 +1,71 @@ +// 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 +{ + public partial class PhraseSuggestHighlight + { + [JsonInclude] + [JsonPropertyName("post_tag")] + public string PostTag { get; set; } + + [JsonInclude] + [JsonPropertyName("pre_tag")] + public string PreTag { get; set; } + } + + public sealed partial class PhraseSuggestHighlightDescriptor : SerializableDescriptorBase + { + internal PhraseSuggestHighlightDescriptor(Action configure) => configure.Invoke(this); + public PhraseSuggestHighlightDescriptor() : base() + { + } + + private string PostTagValue { get; set; } + + private string PreTagValue { get; set; } + + public PhraseSuggestHighlightDescriptor PostTag(string postTag) + { + PostTagValue = postTag; + return Self; + } + + public PhraseSuggestHighlightDescriptor PreTag(string preTag) + { + PreTagValue = preTag; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("post_tag"); + writer.WriteStringValue(PostTagValue); + writer.WritePropertyName("pre_tag"); + writer.WriteStringValue(PreTagValue); + writer.WriteEndObject(); + } + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/PhraseSuggester.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/PhraseSuggester.g.cs new file mode 100644 index 00000000000..02923ded96f --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/PhraseSuggester.g.cs @@ -0,0 +1,881 @@ +// 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 +{ + public partial class PhraseSuggester : SuggesterBase, IFieldSuggesterVariant + { + [JsonInclude] + [JsonPropertyName("collate")] + public Elastic.Clients.Elasticsearch.PhraseSuggestCollate? Collate { get; set; } + + [JsonInclude] + [JsonPropertyName("confidence")] + public double? Confidence { get; set; } + + [JsonInclude] + [JsonPropertyName("direct_generator")] + public IEnumerable? DirectGenerator { get; set; } + + [JsonInclude] + [JsonPropertyName("force_unigrams")] + public bool? ForceUnigrams { get; set; } + + [JsonInclude] + [JsonPropertyName("gram_size")] + public int? GramSize { get; set; } + + [JsonInclude] + [JsonPropertyName("highlight")] + public Elastic.Clients.Elasticsearch.PhraseSuggestHighlight? Highlight { get; set; } + + [JsonInclude] + [JsonPropertyName("max_errors")] + public double? MaxErrors { get; set; } + + [JsonInclude] + [JsonPropertyName("real_word_error_likelihood")] + public double? RealWordErrorLikelihood { get; set; } + + [JsonInclude] + [JsonPropertyName("separator")] + public string? Separator { get; set; } + + [JsonInclude] + [JsonPropertyName("shard_size")] + public int? ShardSize { get; set; } + + [JsonInclude] + [JsonPropertyName("smoothing")] + public Elastic.Clients.Elasticsearch.SmoothingModelContainer? Smoothing { get; set; } + + [JsonInclude] + [JsonPropertyName("text")] + public string? Text { get; set; } + + [JsonInclude] + [JsonPropertyName("token_limit")] + public int? TokenLimit { get; set; } + } + + public sealed partial class PhraseSuggesterDescriptor : SerializableDescriptorBase> + { + internal PhraseSuggesterDescriptor(Action> configure) => configure.Invoke(this); + public PhraseSuggesterDescriptor() : base() + { + } + + private IEnumerable? DirectGeneratorValue { get; set; } + + private DirectGeneratorDescriptor DirectGeneratorDescriptor { get; set; } + + private Action> DirectGeneratorDescriptorAction { get; set; } + + private Action>[] DirectGeneratorDescriptorActions { get; set; } + + private string? AnalyzerValue { get; set; } + + private Elastic.Clients.Elasticsearch.PhraseSuggestCollate? CollateValue { get; set; } + + private PhraseSuggestCollateDescriptor CollateDescriptor { get; set; } + + private Action CollateDescriptorAction { get; set; } + + private double? ConfidenceValue { get; set; } + + private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } + + private bool? ForceUnigramsValue { get; set; } + + private int? GramSizeValue { get; set; } + + private Elastic.Clients.Elasticsearch.PhraseSuggestHighlight? HighlightValue { get; set; } + + private PhraseSuggestHighlightDescriptor HighlightDescriptor { get; set; } + + private Action HighlightDescriptorAction { get; set; } + + private double? MaxErrorsValue { get; set; } + + private double? RealWordErrorLikelihoodValue { get; set; } + + private string? SeparatorValue { get; set; } + + private int? ShardSizeValue { get; set; } + + private int? SizeValue { get; set; } + + private Elastic.Clients.Elasticsearch.SmoothingModelContainer? SmoothingValue { get; set; } + + private SmoothingModelContainerDescriptor SmoothingDescriptor { get; set; } + + private Action SmoothingDescriptorAction { get; set; } + + private string? TextValue { get; set; } + + private int? TokenLimitValue { get; set; } + + public PhraseSuggesterDescriptor DirectGenerator(IEnumerable? directGenerator) + { + DirectGeneratorDescriptor = null; + DirectGeneratorDescriptorAction = null; + DirectGeneratorDescriptorActions = null; + DirectGeneratorValue = directGenerator; + return Self; + } + + public PhraseSuggesterDescriptor DirectGenerator(DirectGeneratorDescriptor descriptor) + { + DirectGeneratorValue = null; + DirectGeneratorDescriptorAction = null; + DirectGeneratorDescriptorActions = null; + DirectGeneratorDescriptor = descriptor; + return Self; + } + + public PhraseSuggesterDescriptor DirectGenerator(Action> configure) + { + DirectGeneratorValue = null; + DirectGeneratorDescriptor = null; + DirectGeneratorDescriptorActions = null; + DirectGeneratorDescriptorAction = configure; + return Self; + } + + public PhraseSuggesterDescriptor DirectGenerator(params Action>[] configure) + { + DirectGeneratorValue = null; + DirectGeneratorDescriptor = null; + DirectGeneratorDescriptorAction = null; + DirectGeneratorDescriptorActions = configure; + return Self; + } + + public PhraseSuggesterDescriptor Analyzer(string? analyzer) + { + AnalyzerValue = analyzer; + return Self; + } + + public PhraseSuggesterDescriptor Collate(Elastic.Clients.Elasticsearch.PhraseSuggestCollate? collate) + { + CollateDescriptor = null; + CollateDescriptorAction = null; + CollateValue = collate; + return Self; + } + + public PhraseSuggesterDescriptor Collate(PhraseSuggestCollateDescriptor descriptor) + { + CollateValue = null; + CollateDescriptorAction = null; + CollateDescriptor = descriptor; + return Self; + } + + public PhraseSuggesterDescriptor Collate(Action configure) + { + CollateValue = null; + CollateDescriptor = null; + CollateDescriptorAction = configure; + return Self; + } + + public PhraseSuggesterDescriptor Confidence(double? confidence) + { + ConfidenceValue = confidence; + return Self; + } + + public PhraseSuggesterDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + { + FieldValue = field; + return Self; + } + + public PhraseSuggesterDescriptor Field(Expression> field) + { + FieldValue = field; + return Self; + } + + public PhraseSuggesterDescriptor ForceUnigrams(bool? forceUnigrams = true) + { + ForceUnigramsValue = forceUnigrams; + return Self; + } + + public PhraseSuggesterDescriptor GramSize(int? gramSize) + { + GramSizeValue = gramSize; + return Self; + } + + public PhraseSuggesterDescriptor Highlight(Elastic.Clients.Elasticsearch.PhraseSuggestHighlight? highlight) + { + HighlightDescriptor = null; + HighlightDescriptorAction = null; + HighlightValue = highlight; + return Self; + } + + public PhraseSuggesterDescriptor Highlight(PhraseSuggestHighlightDescriptor descriptor) + { + HighlightValue = null; + HighlightDescriptorAction = null; + HighlightDescriptor = descriptor; + return Self; + } + + public PhraseSuggesterDescriptor Highlight(Action configure) + { + HighlightValue = null; + HighlightDescriptor = null; + HighlightDescriptorAction = configure; + return Self; + } + + public PhraseSuggesterDescriptor MaxErrors(double? maxErrors) + { + MaxErrorsValue = maxErrors; + return Self; + } + + public PhraseSuggesterDescriptor RealWordErrorLikelihood(double? realWordErrorLikelihood) + { + RealWordErrorLikelihoodValue = realWordErrorLikelihood; + return Self; + } + + public PhraseSuggesterDescriptor Separator(string? separator) + { + SeparatorValue = separator; + return Self; + } + + public PhraseSuggesterDescriptor ShardSize(int? shardSize) + { + ShardSizeValue = shardSize; + return Self; + } + + public PhraseSuggesterDescriptor Size(int? size) + { + SizeValue = size; + return Self; + } + + public PhraseSuggesterDescriptor Smoothing(Elastic.Clients.Elasticsearch.SmoothingModelContainer? smoothing) + { + SmoothingDescriptor = null; + SmoothingDescriptorAction = null; + SmoothingValue = smoothing; + return Self; + } + + public PhraseSuggesterDescriptor Smoothing(SmoothingModelContainerDescriptor descriptor) + { + SmoothingValue = null; + SmoothingDescriptorAction = null; + SmoothingDescriptor = descriptor; + return Self; + } + + public PhraseSuggesterDescriptor Smoothing(Action configure) + { + SmoothingValue = null; + SmoothingDescriptor = null; + SmoothingDescriptorAction = configure; + return Self; + } + + public PhraseSuggesterDescriptor Text(string? text) + { + TextValue = text; + return Self; + } + + public PhraseSuggesterDescriptor TokenLimit(int? tokenLimit) + { + TokenLimitValue = tokenLimit; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (DirectGeneratorDescriptor is not null) + { + writer.WritePropertyName("direct_generator"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, DirectGeneratorDescriptor, options); + writer.WriteEndArray(); + } + else if (DirectGeneratorDescriptorAction is not null) + { + writer.WritePropertyName("direct_generator"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, new DirectGeneratorDescriptor(DirectGeneratorDescriptorAction), options); + writer.WriteEndArray(); + } + else if (DirectGeneratorDescriptorActions is not null) + { + writer.WritePropertyName("direct_generator"); + writer.WriteStartArray(); + foreach (var action in DirectGeneratorDescriptorActions) + { + JsonSerializer.Serialize(writer, new DirectGeneratorDescriptor(action), options); + } + + writer.WriteEndArray(); + } + else if (DirectGeneratorValue is not null) + { + writer.WritePropertyName("direct_generator"); + JsonSerializer.Serialize(writer, DirectGeneratorValue, options); + } + + if (!string.IsNullOrEmpty(AnalyzerValue)) + { + writer.WritePropertyName("analyzer"); + writer.WriteStringValue(AnalyzerValue); + } + + if (CollateDescriptor is not null) + { + writer.WritePropertyName("collate"); + JsonSerializer.Serialize(writer, CollateDescriptor, options); + } + else if (CollateDescriptorAction is not null) + { + writer.WritePropertyName("collate"); + JsonSerializer.Serialize(writer, new PhraseSuggestCollateDescriptor(CollateDescriptorAction), options); + } + else if (CollateValue is not null) + { + writer.WritePropertyName("collate"); + JsonSerializer.Serialize(writer, CollateValue, options); + } + + if (ConfidenceValue.HasValue) + { + writer.WritePropertyName("confidence"); + writer.WriteNumberValue(ConfidenceValue.Value); + } + + writer.WritePropertyName("field"); + JsonSerializer.Serialize(writer, FieldValue, options); + if (ForceUnigramsValue.HasValue) + { + writer.WritePropertyName("force_unigrams"); + writer.WriteBooleanValue(ForceUnigramsValue.Value); + } + + if (GramSizeValue.HasValue) + { + writer.WritePropertyName("gram_size"); + writer.WriteNumberValue(GramSizeValue.Value); + } + + if (HighlightDescriptor is not null) + { + writer.WritePropertyName("highlight"); + JsonSerializer.Serialize(writer, HighlightDescriptor, options); + } + else if (HighlightDescriptorAction is not null) + { + writer.WritePropertyName("highlight"); + JsonSerializer.Serialize(writer, new PhraseSuggestHighlightDescriptor(HighlightDescriptorAction), options); + } + else if (HighlightValue is not null) + { + writer.WritePropertyName("highlight"); + JsonSerializer.Serialize(writer, HighlightValue, options); + } + + if (MaxErrorsValue.HasValue) + { + writer.WritePropertyName("max_errors"); + writer.WriteNumberValue(MaxErrorsValue.Value); + } + + if (RealWordErrorLikelihoodValue.HasValue) + { + writer.WritePropertyName("real_word_error_likelihood"); + writer.WriteNumberValue(RealWordErrorLikelihoodValue.Value); + } + + if (!string.IsNullOrEmpty(SeparatorValue)) + { + writer.WritePropertyName("separator"); + writer.WriteStringValue(SeparatorValue); + } + + if (ShardSizeValue.HasValue) + { + writer.WritePropertyName("shard_size"); + writer.WriteNumberValue(ShardSizeValue.Value); + } + + if (SizeValue.HasValue) + { + writer.WritePropertyName("size"); + writer.WriteNumberValue(SizeValue.Value); + } + + if (SmoothingDescriptor is not null) + { + writer.WritePropertyName("smoothing"); + JsonSerializer.Serialize(writer, SmoothingDescriptor, options); + } + else if (SmoothingDescriptorAction is not null) + { + writer.WritePropertyName("smoothing"); + JsonSerializer.Serialize(writer, new SmoothingModelContainerDescriptor(SmoothingDescriptorAction), options); + } + else if (SmoothingValue is not null) + { + writer.WritePropertyName("smoothing"); + JsonSerializer.Serialize(writer, SmoothingValue, options); + } + + if (!string.IsNullOrEmpty(TextValue)) + { + writer.WritePropertyName("text"); + writer.WriteStringValue(TextValue); + } + + if (TokenLimitValue.HasValue) + { + writer.WritePropertyName("token_limit"); + writer.WriteNumberValue(TokenLimitValue.Value); + } + + writer.WriteEndObject(); + } + } + + public sealed partial class PhraseSuggesterDescriptor : SerializableDescriptorBase + { + internal PhraseSuggesterDescriptor(Action configure) => configure.Invoke(this); + public PhraseSuggesterDescriptor() : base() + { + } + + private IEnumerable? DirectGeneratorValue { get; set; } + + private DirectGeneratorDescriptor DirectGeneratorDescriptor { get; set; } + + private Action DirectGeneratorDescriptorAction { get; set; } + + private Action[] DirectGeneratorDescriptorActions { get; set; } + + private string? AnalyzerValue { get; set; } + + private Elastic.Clients.Elasticsearch.PhraseSuggestCollate? CollateValue { get; set; } + + private PhraseSuggestCollateDescriptor CollateDescriptor { get; set; } + + private Action CollateDescriptorAction { get; set; } + + private double? ConfidenceValue { get; set; } + + private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } + + private bool? ForceUnigramsValue { get; set; } + + private int? GramSizeValue { get; set; } + + private Elastic.Clients.Elasticsearch.PhraseSuggestHighlight? HighlightValue { get; set; } + + private PhraseSuggestHighlightDescriptor HighlightDescriptor { get; set; } + + private Action HighlightDescriptorAction { get; set; } + + private double? MaxErrorsValue { get; set; } + + private double? RealWordErrorLikelihoodValue { get; set; } + + private string? SeparatorValue { get; set; } + + private int? ShardSizeValue { get; set; } + + private int? SizeValue { get; set; } + + private Elastic.Clients.Elasticsearch.SmoothingModelContainer? SmoothingValue { get; set; } + + private SmoothingModelContainerDescriptor SmoothingDescriptor { get; set; } + + private Action SmoothingDescriptorAction { get; set; } + + private string? TextValue { get; set; } + + private int? TokenLimitValue { get; set; } + + public PhraseSuggesterDescriptor DirectGenerator(IEnumerable? directGenerator) + { + DirectGeneratorDescriptor = null; + DirectGeneratorDescriptorAction = null; + DirectGeneratorDescriptorActions = null; + DirectGeneratorValue = directGenerator; + return Self; + } + + public PhraseSuggesterDescriptor DirectGenerator(DirectGeneratorDescriptor descriptor) + { + DirectGeneratorValue = null; + DirectGeneratorDescriptorAction = null; + DirectGeneratorDescriptorActions = null; + DirectGeneratorDescriptor = descriptor; + return Self; + } + + public PhraseSuggesterDescriptor DirectGenerator(Action configure) + { + DirectGeneratorValue = null; + DirectGeneratorDescriptor = null; + DirectGeneratorDescriptorActions = null; + DirectGeneratorDescriptorAction = configure; + return Self; + } + + public PhraseSuggesterDescriptor DirectGenerator(params Action[] configure) + { + DirectGeneratorValue = null; + DirectGeneratorDescriptor = null; + DirectGeneratorDescriptorAction = null; + DirectGeneratorDescriptorActions = configure; + return Self; + } + + public PhraseSuggesterDescriptor Analyzer(string? analyzer) + { + AnalyzerValue = analyzer; + return Self; + } + + public PhraseSuggesterDescriptor Collate(Elastic.Clients.Elasticsearch.PhraseSuggestCollate? collate) + { + CollateDescriptor = null; + CollateDescriptorAction = null; + CollateValue = collate; + return Self; + } + + public PhraseSuggesterDescriptor Collate(PhraseSuggestCollateDescriptor descriptor) + { + CollateValue = null; + CollateDescriptorAction = null; + CollateDescriptor = descriptor; + return Self; + } + + public PhraseSuggesterDescriptor Collate(Action configure) + { + CollateValue = null; + CollateDescriptor = null; + CollateDescriptorAction = configure; + return Self; + } + + public PhraseSuggesterDescriptor Confidence(double? confidence) + { + ConfidenceValue = confidence; + return Self; + } + + public PhraseSuggesterDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + { + FieldValue = field; + return Self; + } + + public PhraseSuggesterDescriptor Field(Expression> field) + { + FieldValue = field; + return Self; + } + + public PhraseSuggesterDescriptor Field(Expression> field) + { + FieldValue = field; + return Self; + } + + public PhraseSuggesterDescriptor ForceUnigrams(bool? forceUnigrams = true) + { + ForceUnigramsValue = forceUnigrams; + return Self; + } + + public PhraseSuggesterDescriptor GramSize(int? gramSize) + { + GramSizeValue = gramSize; + return Self; + } + + public PhraseSuggesterDescriptor Highlight(Elastic.Clients.Elasticsearch.PhraseSuggestHighlight? highlight) + { + HighlightDescriptor = null; + HighlightDescriptorAction = null; + HighlightValue = highlight; + return Self; + } + + public PhraseSuggesterDescriptor Highlight(PhraseSuggestHighlightDescriptor descriptor) + { + HighlightValue = null; + HighlightDescriptorAction = null; + HighlightDescriptor = descriptor; + return Self; + } + + public PhraseSuggesterDescriptor Highlight(Action configure) + { + HighlightValue = null; + HighlightDescriptor = null; + HighlightDescriptorAction = configure; + return Self; + } + + public PhraseSuggesterDescriptor MaxErrors(double? maxErrors) + { + MaxErrorsValue = maxErrors; + return Self; + } + + public PhraseSuggesterDescriptor RealWordErrorLikelihood(double? realWordErrorLikelihood) + { + RealWordErrorLikelihoodValue = realWordErrorLikelihood; + return Self; + } + + public PhraseSuggesterDescriptor Separator(string? separator) + { + SeparatorValue = separator; + return Self; + } + + public PhraseSuggesterDescriptor ShardSize(int? shardSize) + { + ShardSizeValue = shardSize; + return Self; + } + + public PhraseSuggesterDescriptor Size(int? size) + { + SizeValue = size; + return Self; + } + + public PhraseSuggesterDescriptor Smoothing(Elastic.Clients.Elasticsearch.SmoothingModelContainer? smoothing) + { + SmoothingDescriptor = null; + SmoothingDescriptorAction = null; + SmoothingValue = smoothing; + return Self; + } + + public PhraseSuggesterDescriptor Smoothing(SmoothingModelContainerDescriptor descriptor) + { + SmoothingValue = null; + SmoothingDescriptorAction = null; + SmoothingDescriptor = descriptor; + return Self; + } + + public PhraseSuggesterDescriptor Smoothing(Action configure) + { + SmoothingValue = null; + SmoothingDescriptor = null; + SmoothingDescriptorAction = configure; + return Self; + } + + public PhraseSuggesterDescriptor Text(string? text) + { + TextValue = text; + return Self; + } + + public PhraseSuggesterDescriptor TokenLimit(int? tokenLimit) + { + TokenLimitValue = tokenLimit; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (DirectGeneratorDescriptor is not null) + { + writer.WritePropertyName("direct_generator"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, DirectGeneratorDescriptor, options); + writer.WriteEndArray(); + } + else if (DirectGeneratorDescriptorAction is not null) + { + writer.WritePropertyName("direct_generator"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, new DirectGeneratorDescriptor(DirectGeneratorDescriptorAction), options); + writer.WriteEndArray(); + } + else if (DirectGeneratorDescriptorActions is not null) + { + writer.WritePropertyName("direct_generator"); + writer.WriteStartArray(); + foreach (var action in DirectGeneratorDescriptorActions) + { + JsonSerializer.Serialize(writer, new DirectGeneratorDescriptor(action), options); + } + + writer.WriteEndArray(); + } + else if (DirectGeneratorValue is not null) + { + writer.WritePropertyName("direct_generator"); + JsonSerializer.Serialize(writer, DirectGeneratorValue, options); + } + + if (!string.IsNullOrEmpty(AnalyzerValue)) + { + writer.WritePropertyName("analyzer"); + writer.WriteStringValue(AnalyzerValue); + } + + if (CollateDescriptor is not null) + { + writer.WritePropertyName("collate"); + JsonSerializer.Serialize(writer, CollateDescriptor, options); + } + else if (CollateDescriptorAction is not null) + { + writer.WritePropertyName("collate"); + JsonSerializer.Serialize(writer, new PhraseSuggestCollateDescriptor(CollateDescriptorAction), options); + } + else if (CollateValue is not null) + { + writer.WritePropertyName("collate"); + JsonSerializer.Serialize(writer, CollateValue, options); + } + + if (ConfidenceValue.HasValue) + { + writer.WritePropertyName("confidence"); + writer.WriteNumberValue(ConfidenceValue.Value); + } + + writer.WritePropertyName("field"); + JsonSerializer.Serialize(writer, FieldValue, options); + if (ForceUnigramsValue.HasValue) + { + writer.WritePropertyName("force_unigrams"); + writer.WriteBooleanValue(ForceUnigramsValue.Value); + } + + if (GramSizeValue.HasValue) + { + writer.WritePropertyName("gram_size"); + writer.WriteNumberValue(GramSizeValue.Value); + } + + if (HighlightDescriptor is not null) + { + writer.WritePropertyName("highlight"); + JsonSerializer.Serialize(writer, HighlightDescriptor, options); + } + else if (HighlightDescriptorAction is not null) + { + writer.WritePropertyName("highlight"); + JsonSerializer.Serialize(writer, new PhraseSuggestHighlightDescriptor(HighlightDescriptorAction), options); + } + else if (HighlightValue is not null) + { + writer.WritePropertyName("highlight"); + JsonSerializer.Serialize(writer, HighlightValue, options); + } + + if (MaxErrorsValue.HasValue) + { + writer.WritePropertyName("max_errors"); + writer.WriteNumberValue(MaxErrorsValue.Value); + } + + if (RealWordErrorLikelihoodValue.HasValue) + { + writer.WritePropertyName("real_word_error_likelihood"); + writer.WriteNumberValue(RealWordErrorLikelihoodValue.Value); + } + + if (!string.IsNullOrEmpty(SeparatorValue)) + { + writer.WritePropertyName("separator"); + writer.WriteStringValue(SeparatorValue); + } + + if (ShardSizeValue.HasValue) + { + writer.WritePropertyName("shard_size"); + writer.WriteNumberValue(ShardSizeValue.Value); + } + + if (SizeValue.HasValue) + { + writer.WritePropertyName("size"); + writer.WriteNumberValue(SizeValue.Value); + } + + if (SmoothingDescriptor is not null) + { + writer.WritePropertyName("smoothing"); + JsonSerializer.Serialize(writer, SmoothingDescriptor, options); + } + else if (SmoothingDescriptorAction is not null) + { + writer.WritePropertyName("smoothing"); + JsonSerializer.Serialize(writer, new SmoothingModelContainerDescriptor(SmoothingDescriptorAction), options); + } + else if (SmoothingValue is not null) + { + writer.WritePropertyName("smoothing"); + JsonSerializer.Serialize(writer, SmoothingValue, options); + } + + if (!string.IsNullOrEmpty(TextValue)) + { + writer.WritePropertyName("text"); + writer.WriteStringValue(TextValue); + } + + if (TokenLimitValue.HasValue) + { + writer.WritePropertyName("token_limit"); + writer.WriteNumberValue(TokenLimitValue.Value); + } + + writer.WriteEndObject(); + } + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/DateRangeQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/DateRangeQuery.g.cs index ec97bb0b44c..b27b253a8ce 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/DateRangeQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/DateRangeQuery.g.cs @@ -184,40 +184,22 @@ internal override void WriteInternal(Utf8JsonWriter writer, DateRangeQuery value [JsonConverter(typeof(DateRangeQueryConverter))] public partial class DateRangeQuery : FieldNameQueryBase, IQueryVariant { - [JsonInclude] - [JsonPropertyName("format")] public string? Format { get; set; } - [JsonInclude] - [JsonPropertyName("from")] public Elastic.Clients.Elasticsearch.DateMath? From { get; set; } - [JsonInclude] - [JsonPropertyName("gt")] public Elastic.Clients.Elasticsearch.DateMath? Gt { get; set; } - [JsonInclude] - [JsonPropertyName("gte")] public Elastic.Clients.Elasticsearch.DateMath? Gte { get; set; } - [JsonInclude] - [JsonPropertyName("lt")] public Elastic.Clients.Elasticsearch.DateMath? Lt { get; set; } - [JsonInclude] - [JsonPropertyName("lte")] public Elastic.Clients.Elasticsearch.DateMath? Lte { get; set; } - [JsonInclude] - [JsonPropertyName("time_zone")] public string? TimeZone { get; set; } - [JsonInclude] - [JsonPropertyName("to")] public Elastic.Clients.Elasticsearch.DateMath? To { get; set; } - [JsonInclude] - [JsonPropertyName("relation")] public Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation? Relation { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/FuzzyQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/FuzzyQuery.g.cs index 44344f86af4..2b95cd3bbcc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/FuzzyQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/FuzzyQuery.g.cs @@ -144,28 +144,16 @@ internal override void WriteInternal(Utf8JsonWriter writer, FuzzyQuery value, Js [JsonConverter(typeof(FuzzyQueryConverter))] public partial class FuzzyQuery : FieldNameQueryBase, IQueryVariant { - [JsonInclude] - [JsonPropertyName("fuzziness")] public Elastic.Clients.Elasticsearch.Fuzziness? Fuzziness { get; set; } - [JsonInclude] - [JsonPropertyName("max_expansions")] public int? MaxExpansions { get; set; } - [JsonInclude] - [JsonPropertyName("prefix_length")] public int? PrefixLength { get; set; } - [JsonInclude] - [JsonPropertyName("rewrite")] public string? Rewrite { get; set; } - [JsonInclude] - [JsonPropertyName("transpositions")] public bool? Transpositions { get; set; } - [JsonInclude] - [JsonPropertyName("value")] public object Value { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoBoundingBoxQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoBoundingBoxQuery.g.cs index 4ff20e065e5..802eb227fad 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoBoundingBoxQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoBoundingBoxQuery.g.cs @@ -66,7 +66,6 @@ public override GeoBoundingBoxQuery Read(ref Utf8JsonReader reader, Type typeToC } } - reader.Read(); return variant; } @@ -116,20 +115,12 @@ public override void Write(Utf8JsonWriter writer, GeoBoundingBoxQuery value, Jso [JsonConverter(typeof(GeoBoundingBoxQueryConverter))] public partial class GeoBoundingBoxQuery : QueryBase, IQueryVariant { - [JsonInclude] - [JsonPropertyName("bounding_box")] public Elastic.Clients.Elasticsearch.GeoBounds BoundingBox { get; set; } - [JsonInclude] - [JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field Field { get; set; } - [JsonInclude] - [JsonPropertyName("ignore_unmapped")] public bool? IgnoreUnmapped { get; set; } - [JsonInclude] - [JsonPropertyName("validation_method")] public Elastic.Clients.Elasticsearch.QueryDsl.GeoValidationMethod? ValidationMethod { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoDistanceQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoDistanceQuery.g.cs index 50c86820678..5d80b6c2c8b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoDistanceQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoDistanceQuery.g.cs @@ -72,7 +72,6 @@ public override GeoDistanceQuery Read(ref Utf8JsonReader reader, Type typeToConv } } - reader.Read(); return variant; } @@ -128,24 +127,14 @@ public override void Write(Utf8JsonWriter writer, GeoDistanceQuery value, JsonSe [JsonConverter(typeof(GeoDistanceQueryConverter))] public partial class GeoDistanceQuery : QueryBase, IQueryVariant { - [JsonInclude] - [JsonPropertyName("distance")] public string? Distance { get; set; } - [JsonInclude] - [JsonPropertyName("distance_type")] public Elastic.Clients.Elasticsearch.GeoDistanceType? DistanceType { get; set; } - [JsonInclude] - [JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field Field { get; set; } - [JsonInclude] - [JsonPropertyName("location")] public Elastic.Clients.Elasticsearch.GeoLocation Location { get; set; } - [JsonInclude] - [JsonPropertyName("validation_method")] public Elastic.Clients.Elasticsearch.QueryDsl.GeoValidationMethod? ValidationMethod { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoPolygonQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoPolygonQuery.g.cs index dc9fea7f97f..5abfd208314 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoPolygonQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoPolygonQuery.g.cs @@ -66,7 +66,6 @@ public override GeoPolygonQuery Read(ref Utf8JsonReader reader, Type typeToConve } } - reader.Read(); return variant; } @@ -116,20 +115,12 @@ public override void Write(Utf8JsonWriter writer, GeoPolygonQuery value, JsonSer [JsonConverter(typeof(GeoPolygonQueryConverter))] public partial class GeoPolygonQuery : QueryBase, IQueryVariant { - [JsonInclude] - [JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field Field { get; set; } - [JsonInclude] - [JsonPropertyName("ignore_unmapped")] public bool? IgnoreUnmapped { get; set; } - [JsonInclude] - [JsonPropertyName("polygon")] public Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonPoints Polygon { get; set; } - [JsonInclude] - [JsonPropertyName("validation_method")] public Elastic.Clients.Elasticsearch.QueryDsl.GeoValidationMethod? ValidationMethod { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoShapeQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoShapeQuery.g.cs index 7400d83457f..ee00c508b9b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoShapeQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoShapeQuery.g.cs @@ -60,7 +60,6 @@ public override GeoShapeQuery Read(ref Utf8JsonReader reader, Type typeToConvert } } - reader.Read(); return variant; } @@ -104,16 +103,10 @@ public override void Write(Utf8JsonWriter writer, GeoShapeQuery value, JsonSeria [JsonConverter(typeof(GeoShapeQueryConverter))] public partial class GeoShapeQuery : QueryBase, IQueryVariant { - [JsonInclude] - [JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field Field { get; set; } - [JsonInclude] - [JsonPropertyName("ignore_unmapped")] public bool? IgnoreUnmapped { get; set; } - [JsonInclude] - [JsonPropertyName("shape")] public Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQuery Shape { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchBoolPrefixQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchBoolPrefixQuery.g.cs index 457b695c371..372b48b8fbc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchBoolPrefixQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchBoolPrefixQuery.g.cs @@ -180,40 +180,22 @@ internal override void WriteInternal(Utf8JsonWriter writer, MatchBoolPrefixQuery [JsonConverter(typeof(MatchBoolPrefixQueryConverter))] public partial class MatchBoolPrefixQuery : FieldNameQueryBase, IQueryVariant { - [JsonInclude] - [JsonPropertyName("analyzer")] public string? Analyzer { get; set; } - [JsonInclude] - [JsonPropertyName("fuzziness")] public Elastic.Clients.Elasticsearch.Fuzziness? Fuzziness { get; set; } - [JsonInclude] - [JsonPropertyName("fuzzy_rewrite")] public string? FuzzyRewrite { get; set; } - [JsonInclude] - [JsonPropertyName("fuzzy_transpositions")] public bool? FuzzyTranspositions { get; set; } - [JsonInclude] - [JsonPropertyName("max_expansions")] public int? MaxExpansions { get; set; } - [JsonInclude] - [JsonPropertyName("minimum_should_match")] public Elastic.Clients.Elasticsearch.MinimumShouldMatch? MinimumShouldMatch { get; set; } - [JsonInclude] - [JsonPropertyName("operator")] public Elastic.Clients.Elasticsearch.QueryDsl.Operator? Operator { get; set; } - [JsonInclude] - [JsonPropertyName("prefix_length")] public int? PrefixLength { get; set; } - [JsonInclude] - [JsonPropertyName("query")] public string Query { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchPhrasePrefixQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchPhrasePrefixQuery.g.cs index 8b66d3a54c8..a657ffada18 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchPhrasePrefixQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchPhrasePrefixQuery.g.cs @@ -132,24 +132,14 @@ internal override void WriteInternal(Utf8JsonWriter writer, MatchPhrasePrefixQue [JsonConverter(typeof(MatchPhrasePrefixQueryConverter))] public partial class MatchPhrasePrefixQuery : FieldNameQueryBase, IQueryVariant { - [JsonInclude] - [JsonPropertyName("analyzer")] public string? Analyzer { get; set; } - [JsonInclude] - [JsonPropertyName("max_expansions")] public int? MaxExpansions { get; set; } - [JsonInclude] - [JsonPropertyName("query")] public string Query { get; set; } - [JsonInclude] - [JsonPropertyName("slop")] public int? Slop { get; set; } - [JsonInclude] - [JsonPropertyName("zero_terms_query")] public Elastic.Clients.Elasticsearch.QueryDsl.ZeroTermsQuery? ZeroTermsQuery { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchPhraseQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchPhraseQuery.g.cs index df3aa73db6f..65b20c4e43f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchPhraseQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchPhraseQuery.g.cs @@ -120,20 +120,12 @@ internal override void WriteInternal(Utf8JsonWriter writer, MatchPhraseQuery val [JsonConverter(typeof(MatchPhraseQueryConverter))] public partial class MatchPhraseQuery : FieldNameQueryBase, IQueryVariant { - [JsonInclude] - [JsonPropertyName("analyzer")] public string? Analyzer { get; set; } - [JsonInclude] - [JsonPropertyName("query")] public string Query { get; set; } - [JsonInclude] - [JsonPropertyName("slop")] public int? Slop { get; set; } - [JsonInclude] - [JsonPropertyName("zero_terms_query")] public Elastic.Clients.Elasticsearch.QueryDsl.ZeroTermsQuery? ZeroTermsQuery { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchQuery.g.cs index c4ad8e9b457..4deeaaeeff4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchQuery.g.cs @@ -216,52 +216,28 @@ internal override void WriteInternal(Utf8JsonWriter writer, MatchQuery value, Js [JsonConverter(typeof(MatchQueryConverter))] public partial class MatchQuery : FieldNameQueryBase, IQueryVariant { - [JsonInclude] - [JsonPropertyName("analyzer")] public string? Analyzer { get; set; } - [JsonInclude] - [JsonPropertyName("auto_generate_synonyms_phrase_query")] public bool? AutoGenerateSynonymsPhraseQuery { get; set; } - [JsonInclude] - [JsonPropertyName("fuzziness")] public Elastic.Clients.Elasticsearch.Fuzziness? Fuzziness { get; set; } - [JsonInclude] - [JsonPropertyName("fuzzy_rewrite")] public string? FuzzyRewrite { get; set; } - [JsonInclude] - [JsonPropertyName("fuzzy_transpositions")] public bool? FuzzyTranspositions { get; set; } - [JsonInclude] - [JsonPropertyName("lenient")] public bool? Lenient { get; set; } - [JsonInclude] - [JsonPropertyName("max_expansions")] public int? MaxExpansions { get; set; } - [JsonInclude] - [JsonPropertyName("minimum_should_match")] public Elastic.Clients.Elasticsearch.MinimumShouldMatch? MinimumShouldMatch { get; set; } - [JsonInclude] - [JsonPropertyName("operator")] public Elastic.Clients.Elasticsearch.QueryDsl.Operator? Operator { get; set; } - [JsonInclude] - [JsonPropertyName("prefix_length")] public int? PrefixLength { get; set; } - [JsonInclude] - [JsonPropertyName("query")] public string Query { get; set; } - [JsonInclude] - [JsonPropertyName("zero_terms_query")] public Elastic.Clients.Elasticsearch.QueryDsl.ZeroTermsQuery? ZeroTermsQuery { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/NumberRangeQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/NumberRangeQuery.g.cs index fa839047fdf..c15e66238ab 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/NumberRangeQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/NumberRangeQuery.g.cs @@ -160,32 +160,18 @@ internal override void WriteInternal(Utf8JsonWriter writer, NumberRangeQuery val [JsonConverter(typeof(NumberRangeQueryConverter))] public partial class NumberRangeQuery : FieldNameQueryBase, IQueryVariant { - [JsonInclude] - [JsonPropertyName("from")] public double? From { get; set; } - [JsonInclude] - [JsonPropertyName("gt")] public double? Gt { get; set; } - [JsonInclude] - [JsonPropertyName("gte")] public double? Gte { get; set; } - [JsonInclude] - [JsonPropertyName("lt")] public double? Lt { get; set; } - [JsonInclude] - [JsonPropertyName("lte")] public double? Lte { get; set; } - [JsonInclude] - [JsonPropertyName("to")] public double? To { get; set; } - [JsonInclude] - [JsonPropertyName("relation")] public Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation? Relation { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/PrefixQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/PrefixQuery.g.cs index 56f6d40c1d5..462d041fa33 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/PrefixQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/PrefixQuery.g.cs @@ -108,16 +108,10 @@ internal override void WriteInternal(Utf8JsonWriter writer, PrefixQuery value, J [JsonConverter(typeof(PrefixQueryConverter))] public partial class PrefixQuery : FieldNameQueryBase, IQueryVariant { - [JsonInclude] - [JsonPropertyName("case_insensitive")] public bool? CaseInsensitive { get; set; } - [JsonInclude] - [JsonPropertyName("rewrite")] public string? Rewrite { get; set; } - [JsonInclude] - [JsonPropertyName("value")] public string Value { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RegexpQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RegexpQuery.g.cs index d0e41099b70..66ef163a0f6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RegexpQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RegexpQuery.g.cs @@ -132,24 +132,14 @@ internal override void WriteInternal(Utf8JsonWriter writer, RegexpQuery value, J [JsonConverter(typeof(RegexpQueryConverter))] public partial class RegexpQuery : FieldNameQueryBase, IQueryVariant { - [JsonInclude] - [JsonPropertyName("case_insensitive")] public bool? CaseInsensitive { get; set; } - [JsonInclude] - [JsonPropertyName("flags")] public string? Flags { get; set; } - [JsonInclude] - [JsonPropertyName("max_determinized_states")] public int? MaxDeterminizedStates { get; set; } - [JsonInclude] - [JsonPropertyName("rewrite")] public string? Rewrite { get; set; } - [JsonInclude] - [JsonPropertyName("value")] public string Value { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/ShapeQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/ShapeQuery.g.cs index 1e32d976456..f17737f88b9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/ShapeQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/ShapeQuery.g.cs @@ -60,7 +60,6 @@ public override ShapeQuery Read(ref Utf8JsonReader reader, Type typeToConvert, J } } - reader.Read(); return variant; } @@ -104,16 +103,10 @@ public override void Write(Utf8JsonWriter writer, ShapeQuery value, JsonSerializ [JsonConverter(typeof(ShapeQueryConverter))] public partial class ShapeQuery : QueryBase, IQueryVariant { - [JsonInclude] - [JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field Field { get; set; } - [JsonInclude] - [JsonPropertyName("ignore_unmapped")] public bool? IgnoreUnmapped { get; set; } - [JsonInclude] - [JsonPropertyName("shape")] public Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQuery Shape { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanTermQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanTermQuery.g.cs index ff04786e417..437086128c7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanTermQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanTermQuery.g.cs @@ -84,8 +84,6 @@ internal override void WriteInternal(Utf8JsonWriter writer, SpanTermQuery value, [JsonConverter(typeof(SpanTermQueryConverter))] public partial class SpanTermQuery : FieldNameQueryBase, IQueryVariant, ISpanQueryVariant { - [JsonInclude] - [JsonPropertyName("value")] public string Value { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermQuery.g.cs index 99af682435a..8897dd4ecee 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermQuery.g.cs @@ -96,12 +96,8 @@ internal override void WriteInternal(Utf8JsonWriter writer, TermQuery value, Jso [JsonConverter(typeof(TermQueryConverter))] public partial class TermQuery : FieldNameQueryBase, IQueryVariant { - [JsonInclude] - [JsonPropertyName("case_insensitive")] public bool? CaseInsensitive { get; set; } - [JsonInclude] - [JsonPropertyName("value")] public object Value { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermsQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermsQuery.g.cs index d5048d17a7f..d90bbb4e7a3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermsQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermsQuery.g.cs @@ -54,7 +54,6 @@ public override TermsQuery Read(ref Utf8JsonReader reader, Type typeToConvert, J } } - reader.Read(); return variant; } @@ -92,12 +91,8 @@ public override void Write(Utf8JsonWriter writer, TermsQuery value, JsonSerializ [JsonConverter(typeof(TermsQueryConverter))] public partial class TermsQuery : QueryBase, IQueryVariant { - [JsonInclude] - [JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field Field { get; set; } - [JsonInclude] - [JsonPropertyName("terms")] public Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryField Terms { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermsSetQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermsSetQuery.g.cs index e7955bdc51f..4e1ba9cc6dd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermsSetQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermsSetQuery.g.cs @@ -108,16 +108,10 @@ internal override void WriteInternal(Utf8JsonWriter writer, TermsSetQuery value, [JsonConverter(typeof(TermsSetQueryConverter))] public partial class TermsSetQuery : FieldNameQueryBase, IQueryVariant { - [JsonInclude] - [JsonPropertyName("minimum_should_match_field")] public Elastic.Clients.Elasticsearch.Field? MinimumShouldMatchField { get; set; } - [JsonInclude] - [JsonPropertyName("minimum_should_match_script")] public ScriptBase? MinimumShouldMatchScript { get; set; } - [JsonInclude] - [JsonPropertyName("terms")] public IEnumerable Terms { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/WildcardQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/WildcardQuery.g.cs index a4604257446..be739641cc6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/WildcardQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/WildcardQuery.g.cs @@ -124,20 +124,12 @@ internal override void WriteInternal(Utf8JsonWriter writer, WildcardQuery value, [JsonConverter(typeof(WildcardQueryConverter))] public partial class WildcardQuery : FieldNameQueryBase, IQueryVariant { - [JsonInclude] - [JsonPropertyName("case_insensitive")] public bool? CaseInsensitive { get; set; } - [JsonInclude] - [JsonPropertyName("rewrite")] public string? Rewrite { get; set; } - [JsonInclude] - [JsonPropertyName("value")] public string? Value { get; set; } - [JsonInclude] - [JsonPropertyName("wildcard")] public string? Wildcard { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/SmoothingModelContainer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/SmoothingModelContainer.g.cs new file mode 100644 index 00000000000..2c13bd7ac0e --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/SmoothingModelContainer.g.cs @@ -0,0 +1,250 @@ +// 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 +{ + public interface ISmoothingModelVariant + { + } + + [JsonConverter(typeof(SmoothingModelContainerConverter))] + public partial class SmoothingModelContainer + { + public SmoothingModelContainer(string variantName, ISmoothingModelVariant variant) + { + if (variantName is null) + throw new ArgumentNullException(nameof(variantName)); + if (variant is null) + throw new ArgumentNullException(nameof(variant)); + if (string.IsNullOrWhiteSpace(variantName)) + throw new ArgumentException("Variant name must not be empty or whitespace."); + VariantName = variantName; + Variant = variant; + } + + internal ISmoothingModelVariant Variant { get; } + + internal string VariantName { get; } + + public static SmoothingModelContainer Laplace(Elastic.Clients.Elasticsearch.LaplaceSmoothingModel laplaceSmoothingModel) => new SmoothingModelContainer("laplace", laplaceSmoothingModel); + public static SmoothingModelContainer LinearInterpolation(Elastic.Clients.Elasticsearch.LinearInterpolationSmoothingModel linearInterpolationSmoothingModel) => new SmoothingModelContainer("linear_interpolation", linearInterpolationSmoothingModel); + public static SmoothingModelContainer StupidBackoff(Elastic.Clients.Elasticsearch.StupidBackoffSmoothingModel stupidBackoffSmoothingModel) => new SmoothingModelContainer("stupid_backoff", stupidBackoffSmoothingModel); + } + + internal sealed class SmoothingModelContainerConverter : JsonConverter + { + public override SmoothingModelContainer Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + { + throw new JsonException("Expected start token."); + } + + reader.Read(); + if (reader.TokenType != JsonTokenType.PropertyName) + { + throw new JsonException("Expected property name token."); + } + + var propertyName = reader.GetString(); + reader.Read(); + if (propertyName == "laplace") + { + var variant = JsonSerializer.Deserialize(ref reader, options); + reader.Read(); + return new SmoothingModelContainer(propertyName, variant); + } + + if (propertyName == "linear_interpolation") + { + var variant = JsonSerializer.Deserialize(ref reader, options); + reader.Read(); + return new SmoothingModelContainer(propertyName, variant); + } + + if (propertyName == "stupid_backoff") + { + var variant = JsonSerializer.Deserialize(ref reader, options); + reader.Read(); + return new SmoothingModelContainer(propertyName, variant); + } + + throw new JsonException(); + } + + public override void Write(Utf8JsonWriter writer, SmoothingModelContainer value, JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WritePropertyName(value.VariantName); + switch (value.VariantName) + { + case "laplace": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.LaplaceSmoothingModel)value.Variant, options); + break; + case "linear_interpolation": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.LinearInterpolationSmoothingModel)value.Variant, options); + break; + case "stupid_backoff": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.StupidBackoffSmoothingModel)value.Variant, options); + break; + } + + writer.WriteEndObject(); + } + } + + public sealed partial class SmoothingModelContainerDescriptor : SerializableDescriptorBase> + { + internal SmoothingModelContainerDescriptor(Action> configure) => configure.Invoke(this); + public SmoothingModelContainerDescriptor() : base() + { + } + + internal bool ContainsVariant { get; private set; } + + internal string ContainedVariantName { get; private set; } + + internal SmoothingModelContainer Container { get; private set; } + + internal Descriptor Descriptor { get; private set; } + + internal Type DescriptorType { get; private set; } + + private void Set(Action descriptorAction, string variantName) + where T : Descriptor, new() + { + if (ContainsVariant) + throw new Exception("TODO"); + ContainedVariantName = variantName; + ContainsVariant = true; + DescriptorType = typeof(T); + var descriptor = new T(); + descriptorAction?.Invoke(descriptor); + Descriptor = descriptor; + } + + private void Set(ISmoothingModelVariant variant, string variantName) + { + if (ContainsVariant) + throw new Exception("TODO"); + Container = new SmoothingModelContainer(variantName, variant); + ContainedVariantName = variantName; + ContainsVariant = true; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + if (!ContainsVariant) + { + writer.WriteNullValue(); + return; + } + + if (Container is not null) + { + JsonSerializer.Serialize(writer, Container, options); + return; + } + + writer.WriteStartObject(); + writer.WritePropertyName(ContainedVariantName); + JsonSerializer.Serialize(writer, Descriptor, DescriptorType, options); + writer.WriteEndObject(); + } + + public void Laplace(LaplaceSmoothingModel variant) => Set(variant, "laplace"); + public void Laplace(Action configure) => Set(configure, "laplace"); + public void LinearInterpolation(LinearInterpolationSmoothingModel variant) => Set(variant, "linear_interpolation"); + public void LinearInterpolation(Action configure) => Set(configure, "linear_interpolation"); + public void StupidBackoff(StupidBackoffSmoothingModel variant) => Set(variant, "stupid_backoff"); + public void StupidBackoff(Action configure) => Set(configure, "stupid_backoff"); + } + + public sealed partial class SmoothingModelContainerDescriptor : SerializableDescriptorBase + { + internal SmoothingModelContainerDescriptor(Action configure) => configure.Invoke(this); + public SmoothingModelContainerDescriptor() : base() + { + } + + internal bool ContainsVariant { get; private set; } + + internal string ContainedVariantName { get; private set; } + + internal SmoothingModelContainer Container { get; private set; } + + internal Descriptor Descriptor { get; private set; } + + internal Type DescriptorType { get; private set; } + + private void Set(Action descriptorAction, string variantName) + where T : Descriptor, new() + { + if (ContainsVariant) + throw new Exception("TODO"); + ContainedVariantName = variantName; + ContainsVariant = true; + DescriptorType = typeof(T); + var descriptor = new T(); + descriptorAction?.Invoke(descriptor); + Descriptor = descriptor; + } + + private void Set(ISmoothingModelVariant variant, string variantName) + { + if (ContainsVariant) + throw new Exception("TODO"); + Container = new SmoothingModelContainer(variantName, variant); + ContainedVariantName = variantName; + ContainsVariant = true; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + if (!ContainsVariant) + { + writer.WriteNullValue(); + return; + } + + if (Container is not null) + { + JsonSerializer.Serialize(writer, Container, options); + return; + } + + writer.WriteStartObject(); + writer.WritePropertyName(ContainedVariantName); + JsonSerializer.Serialize(writer, Descriptor, DescriptorType, options); + writer.WriteEndObject(); + } + + public void Laplace(LaplaceSmoothingModel variant) => Set(variant, "laplace"); + public void Laplace(Action configure) => Set(configure, "laplace"); + public void LinearInterpolation(LinearInterpolationSmoothingModel variant) => Set(variant, "linear_interpolation"); + public void LinearInterpolation(Action configure) => Set(configure, "linear_interpolation"); + public void StupidBackoff(StupidBackoffSmoothingModel variant) => Set(variant, "stupid_backoff"); + public void StupidBackoff(Action configure) => Set(configure, "stupid_backoff"); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/StupidBackoffSmoothingModel.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/StupidBackoffSmoothingModel.g.cs new file mode 100644 index 00000000000..96b5cc3392e --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/StupidBackoffSmoothingModel.g.cs @@ -0,0 +1,57 @@ +// 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 +{ + public partial class StupidBackoffSmoothingModel : ISmoothingModelVariant + { + [JsonInclude] + [JsonPropertyName("discount")] + public double Discount { get; set; } + } + + public sealed partial class StupidBackoffSmoothingModelDescriptor : SerializableDescriptorBase + { + internal StupidBackoffSmoothingModelDescriptor(Action configure) => configure.Invoke(this); + public StupidBackoffSmoothingModelDescriptor() : base() + { + } + + private double DiscountValue { get; set; } + + public StupidBackoffSmoothingModelDescriptor Discount(double discount) + { + DiscountValue = discount; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("discount"); + writer.WriteNumberValue(DiscountValue); + writer.WriteEndObject(); + } + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/SuggestFuzziness.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/SuggestFuzziness.g.cs new file mode 100644 index 00000000000..fd781f66891 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/SuggestFuzziness.g.cs @@ -0,0 +1,133 @@ +// 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 +{ + public partial class SuggestFuzziness + { + [JsonInclude] + [JsonPropertyName("fuzziness")] + public Elastic.Clients.Elasticsearch.Fuzziness? Fuzziness { get; set; } + + [JsonInclude] + [JsonPropertyName("min_length")] + public int? MinLength { get; set; } + + [JsonInclude] + [JsonPropertyName("prefix_length")] + public int? PrefixLength { get; set; } + + [JsonInclude] + [JsonPropertyName("transpositions")] + public bool? Transpositions { get; set; } + + [JsonInclude] + [JsonPropertyName("unicode_aware")] + public bool? UnicodeAware { get; set; } + } + + public sealed partial class SuggestFuzzinessDescriptor : SerializableDescriptorBase + { + internal SuggestFuzzinessDescriptor(Action configure) => configure.Invoke(this); + public SuggestFuzzinessDescriptor() : base() + { + } + + private Elastic.Clients.Elasticsearch.Fuzziness? FuzzinessValue { get; set; } + + private int? MinLengthValue { get; set; } + + private int? PrefixLengthValue { get; set; } + + private bool? TranspositionsValue { get; set; } + + private bool? UnicodeAwareValue { get; set; } + + public SuggestFuzzinessDescriptor Fuzziness(Elastic.Clients.Elasticsearch.Fuzziness? fuzziness) + { + FuzzinessValue = fuzziness; + return Self; + } + + public SuggestFuzzinessDescriptor MinLength(int? minLength) + { + MinLengthValue = minLength; + return Self; + } + + public SuggestFuzzinessDescriptor PrefixLength(int? prefixLength) + { + PrefixLengthValue = prefixLength; + return Self; + } + + public SuggestFuzzinessDescriptor Transpositions(bool? transpositions = true) + { + TranspositionsValue = transpositions; + return Self; + } + + public SuggestFuzzinessDescriptor UnicodeAware(bool? unicodeAware = true) + { + UnicodeAwareValue = unicodeAware; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (FuzzinessValue is not null) + { + writer.WritePropertyName("fuzziness"); + JsonSerializer.Serialize(writer, FuzzinessValue, options); + } + + if (MinLengthValue.HasValue) + { + writer.WritePropertyName("min_length"); + writer.WriteNumberValue(MinLengthValue.Value); + } + + if (PrefixLengthValue.HasValue) + { + writer.WritePropertyName("prefix_length"); + writer.WriteNumberValue(PrefixLengthValue.Value); + } + + if (TranspositionsValue.HasValue) + { + writer.WritePropertyName("transpositions"); + writer.WriteBooleanValue(TranspositionsValue.Value); + } + + if (UnicodeAwareValue.HasValue) + { + writer.WritePropertyName("unicode_aware"); + writer.WriteBooleanValue(UnicodeAwareValue.Value); + } + + writer.WriteEndObject(); + } + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Suggester.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Suggester.g.cs index 364467ea9cf..4832e021767 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Suggester.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Suggester.g.cs @@ -24,10 +24,62 @@ #nullable restore namespace Elastic.Clients.Elasticsearch { + internal sealed class SuggesterConverter : JsonConverter + { + public override Suggester Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + throw new JsonException("Unexpected JSON detected."); + var variant = new Suggester(); + Dictionary additionalProperties = null; + while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + { + if (reader.TokenType == JsonTokenType.PropertyName) + { + var property = reader.GetString(); + if (property == "text") + { + variant.Text = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + additionalProperties ??= new Dictionary(); + var value = JsonSerializer.Deserialize(ref reader, options); + additionalProperties.Add(property, value); + } + } + + variant.Suggesters = additionalProperties; + return variant; + } + + public override void Write(Utf8JsonWriter writer, Suggester value, JsonSerializerOptions options) + { + writer.WriteStartObject(); + if (value.Suggesters != null) + { + foreach (var additionalProperty in value.Suggesters) + { + writer.WritePropertyName(additionalProperty.Key); + JsonSerializer.Serialize(writer, additionalProperty.Value, options); + } + } + + if (!string.IsNullOrEmpty(value.Text)) + { + writer.WritePropertyName("text"); + writer.WriteStringValue(value.Text); + } + + writer.WriteEndObject(); + } + } + + [JsonConverter(typeof(SuggesterConverter))] public partial class Suggester { - [JsonInclude] - [JsonPropertyName("text")] + public Dictionary Suggesters { get; set; } + public string? Text { get; set; } } @@ -38,8 +90,16 @@ public SuggesterDescriptor() : base() { } + private Dictionary SuggestersValue { get; set; } + private string? TextValue { get; set; } + public SuggesterDescriptor Suggesters(Func, FluentDictionary> selector) + { + SuggestersValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + public SuggesterDescriptor Text(string? text) { TextValue = text; @@ -55,6 +115,15 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o writer.WriteStringValue(TextValue); } + if (SuggestersValue != null) + { + foreach (var additionalProperty in SuggestersValue) + { + writer.WritePropertyName(additionalProperty.Key); + JsonSerializer.Serialize(writer, additionalProperty.Value, options); + } + } + writer.WriteEndObject(); } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/SuggesterBase.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/SuggesterBase.g.cs new file mode 100644 index 00000000000..0369bb214fe --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/SuggesterBase.g.cs @@ -0,0 +1,41 @@ +// 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 +{ + public abstract partial class SuggesterBase + { + [JsonInclude] + [JsonPropertyName("analyzer")] + public string? Analyzer { get; set; } + + [JsonInclude] + [JsonPropertyName("field")] + public Elastic.Clients.Elasticsearch.Field Field { get; set; } + + [JsonInclude] + [JsonPropertyName("size")] + public int? Size { get; set; } + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TermSuggester.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TermSuggester.g.cs new file mode 100644 index 00000000000..85bf647c8a3 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TermSuggester.g.cs @@ -0,0 +1,535 @@ +// 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 +{ + public partial class TermSuggester : SuggesterBase, IFieldSuggesterVariant + { + [JsonInclude] + [JsonPropertyName("lowercase_terms")] + public bool? LowercaseTerms { get; set; } + + [JsonInclude] + [JsonPropertyName("max_edits")] + public int? MaxEdits { get; set; } + + [JsonInclude] + [JsonPropertyName("max_inspections")] + public int? MaxInspections { get; set; } + + [JsonInclude] + [JsonPropertyName("max_term_freq")] + public float? MaxTermFreq { get; set; } + + [JsonInclude] + [JsonPropertyName("min_doc_freq")] + public float? MinDocFreq { get; set; } + + [JsonInclude] + [JsonPropertyName("min_word_length")] + public int? MinWordLength { get; set; } + + [JsonInclude] + [JsonPropertyName("prefix_length")] + public int? PrefixLength { get; set; } + + [JsonInclude] + [JsonPropertyName("shard_size")] + public int? ShardSize { get; set; } + + [JsonInclude] + [JsonPropertyName("sort")] + public Elastic.Clients.Elasticsearch.SuggestSort? Sort { get; set; } + + [JsonInclude] + [JsonPropertyName("string_distance")] + public Elastic.Clients.Elasticsearch.StringDistance? StringDistance { get; set; } + + [JsonInclude] + [JsonPropertyName("suggest_mode")] + public Elastic.Clients.Elasticsearch.SuggestMode? SuggestMode { get; set; } + + [JsonInclude] + [JsonPropertyName("text")] + public string? Text { get; set; } + } + + public sealed partial class TermSuggesterDescriptor : SerializableDescriptorBase> + { + internal TermSuggesterDescriptor(Action> configure) => configure.Invoke(this); + public TermSuggesterDescriptor() : base() + { + } + + private string? AnalyzerValue { get; set; } + + private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } + + private bool? LowercaseTermsValue { get; set; } + + private int? MaxEditsValue { get; set; } + + private int? MaxInspectionsValue { get; set; } + + private float? MaxTermFreqValue { get; set; } + + private float? MinDocFreqValue { get; set; } + + private int? MinWordLengthValue { get; set; } + + private int? PrefixLengthValue { get; set; } + + private int? ShardSizeValue { get; set; } + + private int? SizeValue { get; set; } + + private Elastic.Clients.Elasticsearch.SuggestSort? SortValue { get; set; } + + private Elastic.Clients.Elasticsearch.StringDistance? StringDistanceValue { get; set; } + + private Elastic.Clients.Elasticsearch.SuggestMode? SuggestModeValue { get; set; } + + private string? TextValue { get; set; } + + public TermSuggesterDescriptor Analyzer(string? analyzer) + { + AnalyzerValue = analyzer; + return Self; + } + + public TermSuggesterDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + { + FieldValue = field; + return Self; + } + + public TermSuggesterDescriptor Field(Expression> field) + { + FieldValue = field; + return Self; + } + + public TermSuggesterDescriptor LowercaseTerms(bool? lowercaseTerms = true) + { + LowercaseTermsValue = lowercaseTerms; + return Self; + } + + public TermSuggesterDescriptor MaxEdits(int? maxEdits) + { + MaxEditsValue = maxEdits; + return Self; + } + + public TermSuggesterDescriptor MaxInspections(int? maxInspections) + { + MaxInspectionsValue = maxInspections; + return Self; + } + + public TermSuggesterDescriptor MaxTermFreq(float? maxTermFreq) + { + MaxTermFreqValue = maxTermFreq; + return Self; + } + + public TermSuggesterDescriptor MinDocFreq(float? minDocFreq) + { + MinDocFreqValue = minDocFreq; + return Self; + } + + public TermSuggesterDescriptor MinWordLength(int? minWordLength) + { + MinWordLengthValue = minWordLength; + return Self; + } + + public TermSuggesterDescriptor PrefixLength(int? prefixLength) + { + PrefixLengthValue = prefixLength; + return Self; + } + + public TermSuggesterDescriptor ShardSize(int? shardSize) + { + ShardSizeValue = shardSize; + return Self; + } + + public TermSuggesterDescriptor Size(int? size) + { + SizeValue = size; + return Self; + } + + public TermSuggesterDescriptor Sort(Elastic.Clients.Elasticsearch.SuggestSort? sort) + { + SortValue = sort; + return Self; + } + + public TermSuggesterDescriptor StringDistance(Elastic.Clients.Elasticsearch.StringDistance? stringDistance) + { + StringDistanceValue = stringDistance; + return Self; + } + + public TermSuggesterDescriptor SuggestMode(Elastic.Clients.Elasticsearch.SuggestMode? suggestMode) + { + SuggestModeValue = suggestMode; + return Self; + } + + public TermSuggesterDescriptor Text(string? text) + { + TextValue = text; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (!string.IsNullOrEmpty(AnalyzerValue)) + { + writer.WritePropertyName("analyzer"); + writer.WriteStringValue(AnalyzerValue); + } + + writer.WritePropertyName("field"); + JsonSerializer.Serialize(writer, FieldValue, options); + if (LowercaseTermsValue.HasValue) + { + writer.WritePropertyName("lowercase_terms"); + writer.WriteBooleanValue(LowercaseTermsValue.Value); + } + + if (MaxEditsValue.HasValue) + { + writer.WritePropertyName("max_edits"); + writer.WriteNumberValue(MaxEditsValue.Value); + } + + if (MaxInspectionsValue.HasValue) + { + writer.WritePropertyName("max_inspections"); + writer.WriteNumberValue(MaxInspectionsValue.Value); + } + + if (MaxTermFreqValue.HasValue) + { + writer.WritePropertyName("max_term_freq"); + writer.WriteNumberValue(MaxTermFreqValue.Value); + } + + if (MinDocFreqValue.HasValue) + { + writer.WritePropertyName("min_doc_freq"); + writer.WriteNumberValue(MinDocFreqValue.Value); + } + + if (MinWordLengthValue.HasValue) + { + writer.WritePropertyName("min_word_length"); + writer.WriteNumberValue(MinWordLengthValue.Value); + } + + if (PrefixLengthValue.HasValue) + { + writer.WritePropertyName("prefix_length"); + writer.WriteNumberValue(PrefixLengthValue.Value); + } + + if (ShardSizeValue.HasValue) + { + writer.WritePropertyName("shard_size"); + writer.WriteNumberValue(ShardSizeValue.Value); + } + + if (SizeValue.HasValue) + { + writer.WritePropertyName("size"); + writer.WriteNumberValue(SizeValue.Value); + } + + if (SortValue is not null) + { + writer.WritePropertyName("sort"); + JsonSerializer.Serialize(writer, SortValue, options); + } + + if (StringDistanceValue is not null) + { + writer.WritePropertyName("string_distance"); + JsonSerializer.Serialize(writer, StringDistanceValue, options); + } + + if (SuggestModeValue is not null) + { + writer.WritePropertyName("suggest_mode"); + JsonSerializer.Serialize(writer, SuggestModeValue, options); + } + + if (!string.IsNullOrEmpty(TextValue)) + { + writer.WritePropertyName("text"); + writer.WriteStringValue(TextValue); + } + + writer.WriteEndObject(); + } + } + + public sealed partial class TermSuggesterDescriptor : SerializableDescriptorBase + { + internal TermSuggesterDescriptor(Action configure) => configure.Invoke(this); + public TermSuggesterDescriptor() : base() + { + } + + private string? AnalyzerValue { get; set; } + + private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } + + private bool? LowercaseTermsValue { get; set; } + + private int? MaxEditsValue { get; set; } + + private int? MaxInspectionsValue { get; set; } + + private float? MaxTermFreqValue { get; set; } + + private float? MinDocFreqValue { get; set; } + + private int? MinWordLengthValue { get; set; } + + private int? PrefixLengthValue { get; set; } + + private int? ShardSizeValue { get; set; } + + private int? SizeValue { get; set; } + + private Elastic.Clients.Elasticsearch.SuggestSort? SortValue { get; set; } + + private Elastic.Clients.Elasticsearch.StringDistance? StringDistanceValue { get; set; } + + private Elastic.Clients.Elasticsearch.SuggestMode? SuggestModeValue { get; set; } + + private string? TextValue { get; set; } + + public TermSuggesterDescriptor Analyzer(string? analyzer) + { + AnalyzerValue = analyzer; + return Self; + } + + public TermSuggesterDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + { + FieldValue = field; + return Self; + } + + public TermSuggesterDescriptor Field(Expression> field) + { + FieldValue = field; + return Self; + } + + public TermSuggesterDescriptor Field(Expression> field) + { + FieldValue = field; + return Self; + } + + public TermSuggesterDescriptor LowercaseTerms(bool? lowercaseTerms = true) + { + LowercaseTermsValue = lowercaseTerms; + return Self; + } + + public TermSuggesterDescriptor MaxEdits(int? maxEdits) + { + MaxEditsValue = maxEdits; + return Self; + } + + public TermSuggesterDescriptor MaxInspections(int? maxInspections) + { + MaxInspectionsValue = maxInspections; + return Self; + } + + public TermSuggesterDescriptor MaxTermFreq(float? maxTermFreq) + { + MaxTermFreqValue = maxTermFreq; + return Self; + } + + public TermSuggesterDescriptor MinDocFreq(float? minDocFreq) + { + MinDocFreqValue = minDocFreq; + return Self; + } + + public TermSuggesterDescriptor MinWordLength(int? minWordLength) + { + MinWordLengthValue = minWordLength; + return Self; + } + + public TermSuggesterDescriptor PrefixLength(int? prefixLength) + { + PrefixLengthValue = prefixLength; + return Self; + } + + public TermSuggesterDescriptor ShardSize(int? shardSize) + { + ShardSizeValue = shardSize; + return Self; + } + + public TermSuggesterDescriptor Size(int? size) + { + SizeValue = size; + return Self; + } + + public TermSuggesterDescriptor Sort(Elastic.Clients.Elasticsearch.SuggestSort? sort) + { + SortValue = sort; + return Self; + } + + public TermSuggesterDescriptor StringDistance(Elastic.Clients.Elasticsearch.StringDistance? stringDistance) + { + StringDistanceValue = stringDistance; + return Self; + } + + public TermSuggesterDescriptor SuggestMode(Elastic.Clients.Elasticsearch.SuggestMode? suggestMode) + { + SuggestModeValue = suggestMode; + return Self; + } + + public TermSuggesterDescriptor Text(string? text) + { + TextValue = text; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (!string.IsNullOrEmpty(AnalyzerValue)) + { + writer.WritePropertyName("analyzer"); + writer.WriteStringValue(AnalyzerValue); + } + + writer.WritePropertyName("field"); + JsonSerializer.Serialize(writer, FieldValue, options); + if (LowercaseTermsValue.HasValue) + { + writer.WritePropertyName("lowercase_terms"); + writer.WriteBooleanValue(LowercaseTermsValue.Value); + } + + if (MaxEditsValue.HasValue) + { + writer.WritePropertyName("max_edits"); + writer.WriteNumberValue(MaxEditsValue.Value); + } + + if (MaxInspectionsValue.HasValue) + { + writer.WritePropertyName("max_inspections"); + writer.WriteNumberValue(MaxInspectionsValue.Value); + } + + if (MaxTermFreqValue.HasValue) + { + writer.WritePropertyName("max_term_freq"); + writer.WriteNumberValue(MaxTermFreqValue.Value); + } + + if (MinDocFreqValue.HasValue) + { + writer.WritePropertyName("min_doc_freq"); + writer.WriteNumberValue(MinDocFreqValue.Value); + } + + if (MinWordLengthValue.HasValue) + { + writer.WritePropertyName("min_word_length"); + writer.WriteNumberValue(MinWordLengthValue.Value); + } + + if (PrefixLengthValue.HasValue) + { + writer.WritePropertyName("prefix_length"); + writer.WriteNumberValue(PrefixLengthValue.Value); + } + + if (ShardSizeValue.HasValue) + { + writer.WritePropertyName("shard_size"); + writer.WriteNumberValue(ShardSizeValue.Value); + } + + if (SizeValue.HasValue) + { + writer.WritePropertyName("size"); + writer.WriteNumberValue(SizeValue.Value); + } + + if (SortValue is not null) + { + writer.WritePropertyName("sort"); + JsonSerializer.Serialize(writer, SortValue, options); + } + + if (StringDistanceValue is not null) + { + writer.WritePropertyName("string_distance"); + JsonSerializer.Serialize(writer, StringDistanceValue, options); + } + + if (SuggestModeValue is not null) + { + writer.WritePropertyName("suggest_mode"); + JsonSerializer.Serialize(writer, SuggestModeValue, options); + } + + if (!string.IsNullOrEmpty(TextValue)) + { + writer.WritePropertyName("text"); + writer.WriteStringValue(TextValue); + } + + writer.WriteEndObject(); + } + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Jobs.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Jobs.g.cs index a251f0734a5..afeecad1595 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Jobs.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Jobs.g.cs @@ -24,10 +24,45 @@ #nullable restore namespace Elastic.Clients.Elasticsearch.Xpack { + internal sealed class JobsConverter : JsonConverter + { + public override Jobs Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + throw new JsonException("Unexpected JSON detected."); + Elastic.Clients.Elasticsearch.Xpack.AllJobs? all = default; + Dictionary additionalProperties = null; + while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + { + if (reader.TokenType == JsonTokenType.PropertyName) + { + var property = reader.GetString(); + if (property == "_all") + { + all = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + additionalProperties ??= new Dictionary(); + var value = JsonSerializer.Deserialize(ref reader, options); + additionalProperties.Add(property, value); + } + } + + return new Jobs { All = all, JobsDictionary = additionalProperties }; + } + + public override void Write(Utf8JsonWriter writer, Jobs value, JsonSerializerOptions options) + { + throw new NotImplementedException("'Jobs' is a readonly type, used only on responses and does not support being written to JSON."); + } + } + + [JsonConverter(typeof(JobsConverter))] public partial class Jobs { - [JsonInclude] - [JsonPropertyName("_all")] public Elastic.Clients.Elasticsearch.Xpack.AllJobs? All { get; init; } + + public Dictionary JobsDictionary { get; init; } } } \ No newline at end of file diff --git a/tests/Tests/Serialization/SerializerTestBase.cs b/tests/Tests/Serialization/SerializerTestBase.cs index 522a5dbf12e..edb02bcdda8 100644 --- a/tests/Tests/Serialization/SerializerTestBase.cs +++ b/tests/Tests/Serialization/SerializerTestBase.cs @@ -141,7 +141,7 @@ public static async Task RoundTripAndVerifyJson(T data) { var serialisedJson = await SerializeAndGetJsonStringAsync(data); await Verifier.VerifyJson(serialisedJson); - return JsonSerializer.Deserialize(serialisedJson); + return DeserializeJsonString(serialisedJson); } protected static Stream WrapInStream(string json) diff --git a/tests/Tests/Serialization/SuggesterSerializationTests.cs b/tests/Tests/Serialization/SuggesterSerializationTests.cs new file mode 100644 index 00000000000..68b143c567a --- /dev/null +++ b/tests/Tests/Serialization/SuggesterSerializationTests.cs @@ -0,0 +1,50 @@ +// 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.Threading.Tasks; +using Tests.Domain; +using VerifyXunit; + +namespace Tests.Serialization; + +[UsesVerify] +public class SuggesterSerializationTests : SerializerTestBase +{ + [U] + public async Task Suggester_ObjectInitializer_SerializesCorrectly() + { + var suggester = new Suggester + { + Text = "Trying out Elasticsearch", + Suggesters = new System.Collections.Generic.Dictionary + { + { "my-suggester-1", FieldSuggester.Term(new TermSuggester{ Field = Infer.Field(f => f.Description) }) }, + { "my-suggester-2", FieldSuggester.Term(new TermSuggester{ Field = Infer.Field(f => f.LeadDeveloper) }) } + } + }; + + var result = await RoundTripAndVerifyJson(suggester); + + result.Text.Should().Be(suggester.Text); + result.Suggesters.Should().HaveCount(2); + var suggester1 = result.Suggesters["my-suggester-1"].Variant.Should().BeOfType().Subject; + suggester1.Field.Name.Should().Be("description"); + var suggester2 = result.Suggesters["my-suggester-2"].Variant.Should().BeOfType().Subject; + suggester2.Field.Name.Should().Be("leadDeveloper"); + } + + [U] + public async Task Suggester_Descriptor_SerializesCorrectly() + { + // TODO: In a future release, we should ideally support descriptors for values in the fluent dictionary + + var suggester = new SuggesterDescriptor() + .Text("Trying out Elasticsearch") + .Suggesters(s => s + .Add("my-suggester-1", FieldSuggester.Term(new TermSuggester { Field = Infer.Field(f => f.Description) })) + .Add("my-suggester-2", FieldSuggester.Term(new TermSuggester { Field = Infer.Field(f => f.LeadDeveloper) }))); + + await SerializeAndVerifyJson(suggester); + } +} diff --git a/tests/Tests/Serialization/Xpack/MachineLearningJobsSerializationTests.cs b/tests/Tests/Serialization/Xpack/MachineLearningJobsSerializationTests.cs new file mode 100644 index 00000000000..d12f721ba52 --- /dev/null +++ b/tests/Tests/Serialization/Xpack/MachineLearningJobsSerializationTests.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. + +using Elastic.Clients.Elasticsearch.Xpack; +using VerifyXunit; + +namespace Tests.Serialization.Xpack; + +[UsesVerify] +public class MachineLearningJobsSerializationTests : SerializerTestBase +{ + [U] + public void Deserializes_Xpack_Usage_MachineLearning_Jobs() + { + const string json = @"{""_all"":{""count"":1,""created_by"":{},""detectors"":{""avg"":10,""max"":20,""min"":1,""total"":100},""forecasts"": +{""forecasted_jobs"":30,""total"":300},""model_size"":{""avg"":200,""max"":400,""min"":100,""total"":50}}}"; + + var jobs = DeserializeJsonString(json); + + jobs.All.Should().NotBeNull(); + jobs.All.Count.Should().Be(1); + jobs.All.Detectors["avg"].Should().Be(10); + jobs.All.Detectors["max"].Should().Be(20); + jobs.All.Detectors["min"].Should().Be(1); + jobs.All.Detectors["total"].Should().Be(100); + jobs.All.Forecasts["forecasted_jobs"].Should().Be(30); + jobs.All.ModelSize["avg"].Should().Be(200); + jobs.All.ModelSize["max"].Should().Be(400); + jobs.All.ModelSize["min"].Should().Be(100); + jobs.All.ModelSize["total"].Should().Be(50); + } +} diff --git a/tests/Tests/_VerifySnapshots/MGetSerialization.DeserializesError.verified.txt b/tests/Tests/_VerifySnapshots/MGetSerialization.DeserializesError.verified.txt index ba33de609b8..2092ff3ea57 100644 --- a/tests/Tests/_VerifySnapshots/MGetSerialization.DeserializesError.verified.txt +++ b/tests/Tests/_VerifySnapshots/MGetSerialization.DeserializesError.verified.txt @@ -1,7 +1,15 @@ { + Metadata: { + index: devs, + index_uuid: _na_ + }, Reason: routing is required for [devs]/[1001], RootCause: [ { + Metadata: { + index: devs, + index_uuid: _na_ + }, Reason: routing is required for [devs]/[1001], Type: routing_missing_exception } diff --git a/tests/Tests/_VerifySnapshots/SuggesterSerializationTests.Suggester_Descriptor_SerializesCorrectly.verified.txt b/tests/Tests/_VerifySnapshots/SuggesterSerializationTests.Suggester_Descriptor_SerializesCorrectly.verified.txt new file mode 100644 index 00000000000..ffe49805368 --- /dev/null +++ b/tests/Tests/_VerifySnapshots/SuggesterSerializationTests.Suggester_Descriptor_SerializesCorrectly.verified.txt @@ -0,0 +1,13 @@ +{ + my-suggester-1: { + term: { + field: description + } + }, + my-suggester-2: { + term: { + field: leadDeveloper + } + }, + text: Trying out Elasticsearch +} \ No newline at end of file diff --git a/tests/Tests/_VerifySnapshots/SuggesterSerializationTests.Suggester_ObjectInitializer_SerializesCorrectly.verified.txt b/tests/Tests/_VerifySnapshots/SuggesterSerializationTests.Suggester_ObjectInitializer_SerializesCorrectly.verified.txt new file mode 100644 index 00000000000..ffe49805368 --- /dev/null +++ b/tests/Tests/_VerifySnapshots/SuggesterSerializationTests.Suggester_ObjectInitializer_SerializesCorrectly.verified.txt @@ -0,0 +1,13 @@ +{ + my-suggester-1: { + term: { + field: description + } + }, + my-suggester-2: { + term: { + field: leadDeveloper + } + }, + text: Trying out Elasticsearch +} \ No newline at end of file