From e148eaa11ac64f3f62c3cd0b1464462a4d004ccb Mon Sep 17 00:00:00 2001 From: Florian Bernd Date: Thu, 18 Apr 2024 09:25:53 +0200 Subject: [PATCH] Implement `extended_bounds` and `hard_bounds` for `{Date}HistogramAggregation` --- .../DateHistogramAggregation.g.cs | 196 ++++++++++++++++++ .../Aggregations/ExtendedBoundsDate.g.cs | 91 ++++++++ .../Aggregations/ExtendedBoundsFloat.g.cs | 91 ++++++++ .../Aggregations/HistogramAggregation.g.cs | 196 ++++++++++++++++++ .../DateHistogramAggregation.g.cs | 196 ++++++++++++++++++ .../Aggregations/ExtendedBoundsDate.g.cs | 91 ++++++++ .../Aggregations/ExtendedBoundsFloat.g.cs | 91 ++++++++ .../Aggregations/HistogramAggregation.g.cs | 196 ++++++++++++++++++ 8 files changed, 1148 insertions(+) create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/ExtendedBoundsDate.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/ExtendedBoundsFloat.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ExtendedBoundsDate.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ExtendedBoundsFloat.g.cs diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/DateHistogramAggregation.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/DateHistogramAggregation.g.cs index 86b47df64e2..fcb319ce5dd 100644 --- a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/DateHistogramAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/DateHistogramAggregation.g.cs @@ -35,6 +35,12 @@ public sealed partial class DateHistogramAggregation [JsonInclude, JsonPropertyName("calendar_interval")] public Elastic.Clients.Elasticsearch.Serverless.Aggregations.CalendarInterval? CalendarInterval { get; set; } + /// + /// Enables extending the bounds of the histogram beyond the data itself. + /// + [JsonInclude, JsonPropertyName("extended_bounds")] + public Elastic.Clients.Elasticsearch.Serverless.Aggregations.ExtendedBoundsDate? ExtendedBounds { get; set; } + /// /// The date field whose values are use to build a histogram. /// @@ -53,6 +59,12 @@ public sealed partial class DateHistogramAggregation [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } + /// + /// Limits the histogram to specified bounds. + /// + [JsonInclude, JsonPropertyName("hard_bounds")] + public Elastic.Clients.Elasticsearch.Serverless.Aggregations.ExtendedBoundsDate? HardBounds { get; set; } + /// /// Only returns buckets that have `min_doc_count` number of documents.
By default, all buckets between the first bucket that matches documents and the last one are returned.
///
@@ -101,9 +113,15 @@ public DateHistogramAggregationDescriptor() : base() } private Elastic.Clients.Elasticsearch.Serverless.Aggregations.CalendarInterval? CalendarIntervalValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Aggregations.ExtendedBoundsDate? ExtendedBoundsValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Aggregations.ExtendedBoundsDateDescriptor ExtendedBoundsDescriptor { get; set; } + private Action ExtendedBoundsDescriptorAction { get; set; } private Elastic.Clients.Elasticsearch.Serverless.Field? FieldValue { get; set; } private Elastic.Clients.Elasticsearch.Serverless.Duration? FixedIntervalValue { get; set; } private string? FormatValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Aggregations.ExtendedBoundsDate? HardBoundsValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Aggregations.ExtendedBoundsDateDescriptor HardBoundsDescriptor { get; set; } + private Action HardBoundsDescriptorAction { get; set; } private int? MinDocCountValue { get; set; } private DateTimeOffset? MissingValue { get; set; } private Elastic.Clients.Elasticsearch.Serverless.Duration? OffsetValue { get; set; } @@ -121,6 +139,33 @@ public DateHistogramAggregationDescriptor CalendarInterval(Elastic.Cl return Self; } + /// + /// Enables extending the bounds of the histogram beyond the data itself. + /// + public DateHistogramAggregationDescriptor ExtendedBounds(Elastic.Clients.Elasticsearch.Serverless.Aggregations.ExtendedBoundsDate? extendedBounds) + { + ExtendedBoundsDescriptor = null; + ExtendedBoundsDescriptorAction = null; + ExtendedBoundsValue = extendedBounds; + return Self; + } + + public DateHistogramAggregationDescriptor ExtendedBounds(Elastic.Clients.Elasticsearch.Serverless.Aggregations.ExtendedBoundsDateDescriptor descriptor) + { + ExtendedBoundsValue = null; + ExtendedBoundsDescriptorAction = null; + ExtendedBoundsDescriptor = descriptor; + return Self; + } + + public DateHistogramAggregationDescriptor ExtendedBounds(Action configure) + { + ExtendedBoundsValue = null; + ExtendedBoundsDescriptor = null; + ExtendedBoundsDescriptorAction = configure; + return Self; + } + /// /// The date field whose values are use to build a histogram. /// @@ -166,6 +211,33 @@ public DateHistogramAggregationDescriptor Format(string? format) return Self; } + /// + /// Limits the histogram to specified bounds. + /// + public DateHistogramAggregationDescriptor HardBounds(Elastic.Clients.Elasticsearch.Serverless.Aggregations.ExtendedBoundsDate? hardBounds) + { + HardBoundsDescriptor = null; + HardBoundsDescriptorAction = null; + HardBoundsValue = hardBounds; + return Self; + } + + public DateHistogramAggregationDescriptor HardBounds(Elastic.Clients.Elasticsearch.Serverless.Aggregations.ExtendedBoundsDateDescriptor descriptor) + { + HardBoundsValue = null; + HardBoundsDescriptorAction = null; + HardBoundsDescriptor = descriptor; + return Self; + } + + public DateHistogramAggregationDescriptor HardBounds(Action configure) + { + HardBoundsValue = null; + HardBoundsDescriptor = null; + HardBoundsDescriptorAction = configure; + return Self; + } + /// /// Only returns buckets that have `min_doc_count` number of documents.
By default, all buckets between the first bucket that matches documents and the last one are returned.
///
@@ -232,6 +304,22 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o JsonSerializer.Serialize(writer, CalendarIntervalValue, options); } + if (ExtendedBoundsDescriptor is not null) + { + writer.WritePropertyName("extended_bounds"); + JsonSerializer.Serialize(writer, ExtendedBoundsDescriptor, options); + } + else if (ExtendedBoundsDescriptorAction is not null) + { + writer.WritePropertyName("extended_bounds"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Aggregations.ExtendedBoundsDateDescriptor(ExtendedBoundsDescriptorAction), options); + } + else if (ExtendedBoundsValue is not null) + { + writer.WritePropertyName("extended_bounds"); + JsonSerializer.Serialize(writer, ExtendedBoundsValue, options); + } + if (FieldValue is not null) { writer.WritePropertyName("field"); @@ -250,6 +338,22 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o writer.WriteStringValue(FormatValue); } + if (HardBoundsDescriptor is not null) + { + writer.WritePropertyName("hard_bounds"); + JsonSerializer.Serialize(writer, HardBoundsDescriptor, options); + } + else if (HardBoundsDescriptorAction is not null) + { + writer.WritePropertyName("hard_bounds"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Aggregations.ExtendedBoundsDateDescriptor(HardBoundsDescriptorAction), options); + } + else if (HardBoundsValue is not null) + { + writer.WritePropertyName("hard_bounds"); + JsonSerializer.Serialize(writer, HardBoundsValue, options); + } + if (MinDocCountValue.HasValue) { writer.WritePropertyName("min_doc_count"); @@ -305,9 +409,15 @@ public DateHistogramAggregationDescriptor() : base() } private Elastic.Clients.Elasticsearch.Serverless.Aggregations.CalendarInterval? CalendarIntervalValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Aggregations.ExtendedBoundsDate? ExtendedBoundsValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Aggregations.ExtendedBoundsDateDescriptor ExtendedBoundsDescriptor { get; set; } + private Action ExtendedBoundsDescriptorAction { get; set; } private Elastic.Clients.Elasticsearch.Serverless.Field? FieldValue { get; set; } private Elastic.Clients.Elasticsearch.Serverless.Duration? FixedIntervalValue { get; set; } private string? FormatValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Aggregations.ExtendedBoundsDate? HardBoundsValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Aggregations.ExtendedBoundsDateDescriptor HardBoundsDescriptor { get; set; } + private Action HardBoundsDescriptorAction { get; set; } private int? MinDocCountValue { get; set; } private DateTimeOffset? MissingValue { get; set; } private Elastic.Clients.Elasticsearch.Serverless.Duration? OffsetValue { get; set; } @@ -325,6 +435,33 @@ public DateHistogramAggregationDescriptor CalendarInterval(Elastic.Clients.Elast return Self; } + /// + /// Enables extending the bounds of the histogram beyond the data itself. + /// + public DateHistogramAggregationDescriptor ExtendedBounds(Elastic.Clients.Elasticsearch.Serverless.Aggregations.ExtendedBoundsDate? extendedBounds) + { + ExtendedBoundsDescriptor = null; + ExtendedBoundsDescriptorAction = null; + ExtendedBoundsValue = extendedBounds; + return Self; + } + + public DateHistogramAggregationDescriptor ExtendedBounds(Elastic.Clients.Elasticsearch.Serverless.Aggregations.ExtendedBoundsDateDescriptor descriptor) + { + ExtendedBoundsValue = null; + ExtendedBoundsDescriptorAction = null; + ExtendedBoundsDescriptor = descriptor; + return Self; + } + + public DateHistogramAggregationDescriptor ExtendedBounds(Action configure) + { + ExtendedBoundsValue = null; + ExtendedBoundsDescriptor = null; + ExtendedBoundsDescriptorAction = configure; + return Self; + } + /// /// The date field whose values are use to build a histogram. /// @@ -370,6 +507,33 @@ public DateHistogramAggregationDescriptor Format(string? format) return Self; } + /// + /// Limits the histogram to specified bounds. + /// + public DateHistogramAggregationDescriptor HardBounds(Elastic.Clients.Elasticsearch.Serverless.Aggregations.ExtendedBoundsDate? hardBounds) + { + HardBoundsDescriptor = null; + HardBoundsDescriptorAction = null; + HardBoundsValue = hardBounds; + return Self; + } + + public DateHistogramAggregationDescriptor HardBounds(Elastic.Clients.Elasticsearch.Serverless.Aggregations.ExtendedBoundsDateDescriptor descriptor) + { + HardBoundsValue = null; + HardBoundsDescriptorAction = null; + HardBoundsDescriptor = descriptor; + return Self; + } + + public DateHistogramAggregationDescriptor HardBounds(Action configure) + { + HardBoundsValue = null; + HardBoundsDescriptor = null; + HardBoundsDescriptorAction = configure; + return Self; + } + /// /// Only returns buckets that have `min_doc_count` number of documents.
By default, all buckets between the first bucket that matches documents and the last one are returned.
///
@@ -436,6 +600,22 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o JsonSerializer.Serialize(writer, CalendarIntervalValue, options); } + if (ExtendedBoundsDescriptor is not null) + { + writer.WritePropertyName("extended_bounds"); + JsonSerializer.Serialize(writer, ExtendedBoundsDescriptor, options); + } + else if (ExtendedBoundsDescriptorAction is not null) + { + writer.WritePropertyName("extended_bounds"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Aggregations.ExtendedBoundsDateDescriptor(ExtendedBoundsDescriptorAction), options); + } + else if (ExtendedBoundsValue is not null) + { + writer.WritePropertyName("extended_bounds"); + JsonSerializer.Serialize(writer, ExtendedBoundsValue, options); + } + if (FieldValue is not null) { writer.WritePropertyName("field"); @@ -454,6 +634,22 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o writer.WriteStringValue(FormatValue); } + if (HardBoundsDescriptor is not null) + { + writer.WritePropertyName("hard_bounds"); + JsonSerializer.Serialize(writer, HardBoundsDescriptor, options); + } + else if (HardBoundsDescriptorAction is not null) + { + writer.WritePropertyName("hard_bounds"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Aggregations.ExtendedBoundsDateDescriptor(HardBoundsDescriptorAction), options); + } + else if (HardBoundsValue is not null) + { + writer.WritePropertyName("hard_bounds"); + JsonSerializer.Serialize(writer, HardBoundsValue, options); + } + if (MinDocCountValue.HasValue) { writer.WritePropertyName("min_doc_count"); diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/ExtendedBoundsDate.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/ExtendedBoundsDate.g.cs new file mode 100644 index 00000000000..984f26ff3a5 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/ExtendedBoundsDate.g.cs @@ -0,0 +1,91 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Aggregations; + +public sealed partial class ExtendedBoundsDate +{ + /// + /// Maximum value for the bound. + /// + [JsonInclude, JsonPropertyName("max")] + public Elastic.Clients.Elasticsearch.Serverless.Aggregations.FieldDateMath? Max { get; set; } + + /// + /// Minimum value for the bound. + /// + [JsonInclude, JsonPropertyName("min")] + public Elastic.Clients.Elasticsearch.Serverless.Aggregations.FieldDateMath? Min { get; set; } +} + +public sealed partial class ExtendedBoundsDateDescriptor : SerializableDescriptor +{ + internal ExtendedBoundsDateDescriptor(Action configure) => configure.Invoke(this); + + public ExtendedBoundsDateDescriptor() : base() + { + } + + private Elastic.Clients.Elasticsearch.Serverless.Aggregations.FieldDateMath? MaxValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Aggregations.FieldDateMath? MinValue { get; set; } + + /// + /// Maximum value for the bound. + /// + public ExtendedBoundsDateDescriptor Max(Elastic.Clients.Elasticsearch.Serverless.Aggregations.FieldDateMath? max) + { + MaxValue = max; + return Self; + } + + /// + /// Minimum value for the bound. + /// + public ExtendedBoundsDateDescriptor Min(Elastic.Clients.Elasticsearch.Serverless.Aggregations.FieldDateMath? min) + { + MinValue = min; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (MaxValue is not null) + { + writer.WritePropertyName("max"); + JsonSerializer.Serialize(writer, MaxValue, options); + } + + if (MinValue is not null) + { + writer.WritePropertyName("min"); + JsonSerializer.Serialize(writer, MinValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/ExtendedBoundsFloat.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/ExtendedBoundsFloat.g.cs new file mode 100644 index 00000000000..300347d8dc1 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/ExtendedBoundsFloat.g.cs @@ -0,0 +1,91 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Aggregations; + +public sealed partial class ExtendedBoundsFloat +{ + /// + /// Maximum value for the bound. + /// + [JsonInclude, JsonPropertyName("max")] + public float? Max { get; set; } + + /// + /// Minimum value for the bound. + /// + [JsonInclude, JsonPropertyName("min")] + public float? Min { get; set; } +} + +public sealed partial class ExtendedBoundsFloatDescriptor : SerializableDescriptor +{ + internal ExtendedBoundsFloatDescriptor(Action configure) => configure.Invoke(this); + + public ExtendedBoundsFloatDescriptor() : base() + { + } + + private float? MaxValue { get; set; } + private float? MinValue { get; set; } + + /// + /// Maximum value for the bound. + /// + public ExtendedBoundsFloatDescriptor Max(float? max) + { + MaxValue = max; + return Self; + } + + /// + /// Minimum value for the bound. + /// + public ExtendedBoundsFloatDescriptor Min(float? min) + { + MinValue = min; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (MaxValue.HasValue) + { + writer.WritePropertyName("max"); + writer.WriteNumberValue(MaxValue.Value); + } + + if (MinValue.HasValue) + { + writer.WritePropertyName("min"); + writer.WriteNumberValue(MinValue.Value); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/HistogramAggregation.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/HistogramAggregation.g.cs index b61e37c1690..1ec5a6f9c86 100644 --- a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/HistogramAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/HistogramAggregation.g.cs @@ -29,6 +29,12 @@ namespace Elastic.Clients.Elasticsearch.Serverless.Aggregations; public sealed partial class HistogramAggregation { + /// + /// Enables extending the bounds of the histogram beyond the data itself. + /// + [JsonInclude, JsonPropertyName("extended_bounds")] + public Elastic.Clients.Elasticsearch.Serverless.Aggregations.ExtendedBoundsFloat? ExtendedBounds { get; set; } + /// /// The name of the field to aggregate on. /// @@ -37,6 +43,12 @@ public sealed partial class HistogramAggregation [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } + /// + /// Limits the range of buckets in the histogram.
It is particularly useful in the case of open data ranges that can result in a very large number of buckets.
+ ///
+ [JsonInclude, JsonPropertyName("hard_bounds")] + public Elastic.Clients.Elasticsearch.Serverless.Aggregations.ExtendedBoundsFloat? HardBounds { get; set; } + /// /// The interval for the buckets.
Must be a positive decimal.
///
@@ -82,8 +94,14 @@ public HistogramAggregationDescriptor() : base() { } + private Elastic.Clients.Elasticsearch.Serverless.Aggregations.ExtendedBoundsFloat? ExtendedBoundsValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Aggregations.ExtendedBoundsFloatDescriptor ExtendedBoundsDescriptor { get; set; } + private Action ExtendedBoundsDescriptorAction { get; set; } private Elastic.Clients.Elasticsearch.Serverless.Field? FieldValue { get; set; } private string? FormatValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Aggregations.ExtendedBoundsFloat? HardBoundsValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Aggregations.ExtendedBoundsFloatDescriptor HardBoundsDescriptor { get; set; } + private Action HardBoundsDescriptorAction { get; set; } private double? IntervalValue { get; set; } private int? MinDocCountValue { get; set; } private double? MissingValue { get; set; } @@ -91,6 +109,33 @@ public HistogramAggregationDescriptor() : base() private ICollection>? OrderValue { get; set; } private Elastic.Clients.Elasticsearch.Serverless.Script? ScriptValue { get; set; } + /// + /// Enables extending the bounds of the histogram beyond the data itself. + /// + public HistogramAggregationDescriptor ExtendedBounds(Elastic.Clients.Elasticsearch.Serverless.Aggregations.ExtendedBoundsFloat? extendedBounds) + { + ExtendedBoundsDescriptor = null; + ExtendedBoundsDescriptorAction = null; + ExtendedBoundsValue = extendedBounds; + return Self; + } + + public HistogramAggregationDescriptor ExtendedBounds(Elastic.Clients.Elasticsearch.Serverless.Aggregations.ExtendedBoundsFloatDescriptor descriptor) + { + ExtendedBoundsValue = null; + ExtendedBoundsDescriptorAction = null; + ExtendedBoundsDescriptor = descriptor; + return Self; + } + + public HistogramAggregationDescriptor ExtendedBounds(Action configure) + { + ExtendedBoundsValue = null; + ExtendedBoundsDescriptor = null; + ExtendedBoundsDescriptorAction = configure; + return Self; + } + /// /// The name of the field to aggregate on. /// @@ -124,6 +169,33 @@ public HistogramAggregationDescriptor Format(string? format) return Self; } + /// + /// Limits the range of buckets in the histogram.
It is particularly useful in the case of open data ranges that can result in a very large number of buckets.
+ ///
+ public HistogramAggregationDescriptor HardBounds(Elastic.Clients.Elasticsearch.Serverless.Aggregations.ExtendedBoundsFloat? hardBounds) + { + HardBoundsDescriptor = null; + HardBoundsDescriptorAction = null; + HardBoundsValue = hardBounds; + return Self; + } + + public HistogramAggregationDescriptor HardBounds(Elastic.Clients.Elasticsearch.Serverless.Aggregations.ExtendedBoundsFloatDescriptor descriptor) + { + HardBoundsValue = null; + HardBoundsDescriptorAction = null; + HardBoundsDescriptor = descriptor; + return Self; + } + + public HistogramAggregationDescriptor HardBounds(Action configure) + { + HardBoundsValue = null; + HardBoundsDescriptor = null; + HardBoundsDescriptorAction = configure; + return Self; + } + /// /// The interval for the buckets.
Must be a positive decimal.
///
@@ -178,6 +250,22 @@ public HistogramAggregationDescriptor Script(Elastic.Clients.Elastics protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) { writer.WriteStartObject(); + if (ExtendedBoundsDescriptor is not null) + { + writer.WritePropertyName("extended_bounds"); + JsonSerializer.Serialize(writer, ExtendedBoundsDescriptor, options); + } + else if (ExtendedBoundsDescriptorAction is not null) + { + writer.WritePropertyName("extended_bounds"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Aggregations.ExtendedBoundsFloatDescriptor(ExtendedBoundsDescriptorAction), options); + } + else if (ExtendedBoundsValue is not null) + { + writer.WritePropertyName("extended_bounds"); + JsonSerializer.Serialize(writer, ExtendedBoundsValue, options); + } + if (FieldValue is not null) { writer.WritePropertyName("field"); @@ -190,6 +278,22 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o writer.WriteStringValue(FormatValue); } + if (HardBoundsDescriptor is not null) + { + writer.WritePropertyName("hard_bounds"); + JsonSerializer.Serialize(writer, HardBoundsDescriptor, options); + } + else if (HardBoundsDescriptorAction is not null) + { + writer.WritePropertyName("hard_bounds"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Aggregations.ExtendedBoundsFloatDescriptor(HardBoundsDescriptorAction), options); + } + else if (HardBoundsValue is not null) + { + writer.WritePropertyName("hard_bounds"); + JsonSerializer.Serialize(writer, HardBoundsValue, options); + } + if (IntervalValue.HasValue) { writer.WritePropertyName("interval"); @@ -238,8 +342,14 @@ public HistogramAggregationDescriptor() : base() { } + private Elastic.Clients.Elasticsearch.Serverless.Aggregations.ExtendedBoundsFloat? ExtendedBoundsValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Aggregations.ExtendedBoundsFloatDescriptor ExtendedBoundsDescriptor { get; set; } + private Action ExtendedBoundsDescriptorAction { get; set; } private Elastic.Clients.Elasticsearch.Serverless.Field? FieldValue { get; set; } private string? FormatValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Aggregations.ExtendedBoundsFloat? HardBoundsValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Aggregations.ExtendedBoundsFloatDescriptor HardBoundsDescriptor { get; set; } + private Action HardBoundsDescriptorAction { get; set; } private double? IntervalValue { get; set; } private int? MinDocCountValue { get; set; } private double? MissingValue { get; set; } @@ -247,6 +357,33 @@ public HistogramAggregationDescriptor() : base() private ICollection>? OrderValue { get; set; } private Elastic.Clients.Elasticsearch.Serverless.Script? ScriptValue { get; set; } + /// + /// Enables extending the bounds of the histogram beyond the data itself. + /// + public HistogramAggregationDescriptor ExtendedBounds(Elastic.Clients.Elasticsearch.Serverless.Aggregations.ExtendedBoundsFloat? extendedBounds) + { + ExtendedBoundsDescriptor = null; + ExtendedBoundsDescriptorAction = null; + ExtendedBoundsValue = extendedBounds; + return Self; + } + + public HistogramAggregationDescriptor ExtendedBounds(Elastic.Clients.Elasticsearch.Serverless.Aggregations.ExtendedBoundsFloatDescriptor descriptor) + { + ExtendedBoundsValue = null; + ExtendedBoundsDescriptorAction = null; + ExtendedBoundsDescriptor = descriptor; + return Self; + } + + public HistogramAggregationDescriptor ExtendedBounds(Action configure) + { + ExtendedBoundsValue = null; + ExtendedBoundsDescriptor = null; + ExtendedBoundsDescriptorAction = configure; + return Self; + } + /// /// The name of the field to aggregate on. /// @@ -280,6 +417,33 @@ public HistogramAggregationDescriptor Format(string? format) return Self; } + /// + /// Limits the range of buckets in the histogram.
It is particularly useful in the case of open data ranges that can result in a very large number of buckets.
+ ///
+ public HistogramAggregationDescriptor HardBounds(Elastic.Clients.Elasticsearch.Serverless.Aggregations.ExtendedBoundsFloat? hardBounds) + { + HardBoundsDescriptor = null; + HardBoundsDescriptorAction = null; + HardBoundsValue = hardBounds; + return Self; + } + + public HistogramAggregationDescriptor HardBounds(Elastic.Clients.Elasticsearch.Serverless.Aggregations.ExtendedBoundsFloatDescriptor descriptor) + { + HardBoundsValue = null; + HardBoundsDescriptorAction = null; + HardBoundsDescriptor = descriptor; + return Self; + } + + public HistogramAggregationDescriptor HardBounds(Action configure) + { + HardBoundsValue = null; + HardBoundsDescriptor = null; + HardBoundsDescriptorAction = configure; + return Self; + } + /// /// The interval for the buckets.
Must be a positive decimal.
///
@@ -334,6 +498,22 @@ public HistogramAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Serve protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) { writer.WriteStartObject(); + if (ExtendedBoundsDescriptor is not null) + { + writer.WritePropertyName("extended_bounds"); + JsonSerializer.Serialize(writer, ExtendedBoundsDescriptor, options); + } + else if (ExtendedBoundsDescriptorAction is not null) + { + writer.WritePropertyName("extended_bounds"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Aggregations.ExtendedBoundsFloatDescriptor(ExtendedBoundsDescriptorAction), options); + } + else if (ExtendedBoundsValue is not null) + { + writer.WritePropertyName("extended_bounds"); + JsonSerializer.Serialize(writer, ExtendedBoundsValue, options); + } + if (FieldValue is not null) { writer.WritePropertyName("field"); @@ -346,6 +526,22 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o writer.WriteStringValue(FormatValue); } + if (HardBoundsDescriptor is not null) + { + writer.WritePropertyName("hard_bounds"); + JsonSerializer.Serialize(writer, HardBoundsDescriptor, options); + } + else if (HardBoundsDescriptorAction is not null) + { + writer.WritePropertyName("hard_bounds"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Aggregations.ExtendedBoundsFloatDescriptor(HardBoundsDescriptorAction), options); + } + else if (HardBoundsValue is not null) + { + writer.WritePropertyName("hard_bounds"); + JsonSerializer.Serialize(writer, HardBoundsValue, options); + } + if (IntervalValue.HasValue) { writer.WritePropertyName("interval"); 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 40f0c46e6a2..204ae721a17 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DateHistogramAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DateHistogramAggregation.g.cs @@ -35,6 +35,12 @@ public sealed partial class DateHistogramAggregation [JsonInclude, JsonPropertyName("calendar_interval")] public Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval? CalendarInterval { get; set; } + /// + /// Enables extending the bounds of the histogram beyond the data itself. + /// + [JsonInclude, JsonPropertyName("extended_bounds")] + public Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsDate? ExtendedBounds { get; set; } + /// /// The date field whose values are use to build a histogram. /// @@ -53,6 +59,12 @@ public sealed partial class DateHistogramAggregation [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } + /// + /// Limits the histogram to specified bounds. + /// + [JsonInclude, JsonPropertyName("hard_bounds")] + public Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsDate? HardBounds { get; set; } + /// /// Only returns buckets that have `min_doc_count` number of documents.
By default, all buckets between the first bucket that matches documents and the last one are returned.
///
@@ -101,9 +113,15 @@ public DateHistogramAggregationDescriptor() : base() } private Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval? CalendarIntervalValue { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsDate? ExtendedBoundsValue { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsDateDescriptor ExtendedBoundsDescriptor { get; set; } + private Action ExtendedBoundsDescriptorAction { get; set; } private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } private Elastic.Clients.Elasticsearch.Duration? FixedIntervalValue { get; set; } private string? FormatValue { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsDate? HardBoundsValue { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsDateDescriptor HardBoundsDescriptor { get; set; } + private Action HardBoundsDescriptorAction { get; set; } private int? MinDocCountValue { get; set; } private DateTimeOffset? MissingValue { get; set; } private Elastic.Clients.Elasticsearch.Duration? OffsetValue { get; set; } @@ -121,6 +139,33 @@ public DateHistogramAggregationDescriptor CalendarInterval(Elastic.Cl return Self; } + /// + /// Enables extending the bounds of the histogram beyond the data itself. + /// + public DateHistogramAggregationDescriptor ExtendedBounds(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsDate? extendedBounds) + { + ExtendedBoundsDescriptor = null; + ExtendedBoundsDescriptorAction = null; + ExtendedBoundsValue = extendedBounds; + return Self; + } + + public DateHistogramAggregationDescriptor ExtendedBounds(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsDateDescriptor descriptor) + { + ExtendedBoundsValue = null; + ExtendedBoundsDescriptorAction = null; + ExtendedBoundsDescriptor = descriptor; + return Self; + } + + public DateHistogramAggregationDescriptor ExtendedBounds(Action configure) + { + ExtendedBoundsValue = null; + ExtendedBoundsDescriptor = null; + ExtendedBoundsDescriptorAction = configure; + return Self; + } + /// /// The date field whose values are use to build a histogram. /// @@ -166,6 +211,33 @@ public DateHistogramAggregationDescriptor Format(string? format) return Self; } + /// + /// Limits the histogram to specified bounds. + /// + public DateHistogramAggregationDescriptor HardBounds(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsDate? hardBounds) + { + HardBoundsDescriptor = null; + HardBoundsDescriptorAction = null; + HardBoundsValue = hardBounds; + return Self; + } + + public DateHistogramAggregationDescriptor HardBounds(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsDateDescriptor descriptor) + { + HardBoundsValue = null; + HardBoundsDescriptorAction = null; + HardBoundsDescriptor = descriptor; + return Self; + } + + public DateHistogramAggregationDescriptor HardBounds(Action configure) + { + HardBoundsValue = null; + HardBoundsDescriptor = null; + HardBoundsDescriptorAction = configure; + return Self; + } + /// /// Only returns buckets that have `min_doc_count` number of documents.
By default, all buckets between the first bucket that matches documents and the last one are returned.
///
@@ -232,6 +304,22 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o JsonSerializer.Serialize(writer, CalendarIntervalValue, options); } + if (ExtendedBoundsDescriptor is not null) + { + writer.WritePropertyName("extended_bounds"); + JsonSerializer.Serialize(writer, ExtendedBoundsDescriptor, options); + } + else if (ExtendedBoundsDescriptorAction is not null) + { + writer.WritePropertyName("extended_bounds"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsDateDescriptor(ExtendedBoundsDescriptorAction), options); + } + else if (ExtendedBoundsValue is not null) + { + writer.WritePropertyName("extended_bounds"); + JsonSerializer.Serialize(writer, ExtendedBoundsValue, options); + } + if (FieldValue is not null) { writer.WritePropertyName("field"); @@ -250,6 +338,22 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o writer.WriteStringValue(FormatValue); } + if (HardBoundsDescriptor is not null) + { + writer.WritePropertyName("hard_bounds"); + JsonSerializer.Serialize(writer, HardBoundsDescriptor, options); + } + else if (HardBoundsDescriptorAction is not null) + { + writer.WritePropertyName("hard_bounds"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsDateDescriptor(HardBoundsDescriptorAction), options); + } + else if (HardBoundsValue is not null) + { + writer.WritePropertyName("hard_bounds"); + JsonSerializer.Serialize(writer, HardBoundsValue, options); + } + if (MinDocCountValue.HasValue) { writer.WritePropertyName("min_doc_count"); @@ -305,9 +409,15 @@ public DateHistogramAggregationDescriptor() : base() } private Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval? CalendarIntervalValue { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsDate? ExtendedBoundsValue { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsDateDescriptor ExtendedBoundsDescriptor { get; set; } + private Action ExtendedBoundsDescriptorAction { get; set; } private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } private Elastic.Clients.Elasticsearch.Duration? FixedIntervalValue { get; set; } private string? FormatValue { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsDate? HardBoundsValue { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsDateDescriptor HardBoundsDescriptor { get; set; } + private Action HardBoundsDescriptorAction { get; set; } private int? MinDocCountValue { get; set; } private DateTimeOffset? MissingValue { get; set; } private Elastic.Clients.Elasticsearch.Duration? OffsetValue { get; set; } @@ -325,6 +435,33 @@ public DateHistogramAggregationDescriptor CalendarInterval(Elastic.Clients.Elast return Self; } + /// + /// Enables extending the bounds of the histogram beyond the data itself. + /// + public DateHistogramAggregationDescriptor ExtendedBounds(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsDate? extendedBounds) + { + ExtendedBoundsDescriptor = null; + ExtendedBoundsDescriptorAction = null; + ExtendedBoundsValue = extendedBounds; + return Self; + } + + public DateHistogramAggregationDescriptor ExtendedBounds(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsDateDescriptor descriptor) + { + ExtendedBoundsValue = null; + ExtendedBoundsDescriptorAction = null; + ExtendedBoundsDescriptor = descriptor; + return Self; + } + + public DateHistogramAggregationDescriptor ExtendedBounds(Action configure) + { + ExtendedBoundsValue = null; + ExtendedBoundsDescriptor = null; + ExtendedBoundsDescriptorAction = configure; + return Self; + } + /// /// The date field whose values are use to build a histogram. /// @@ -370,6 +507,33 @@ public DateHistogramAggregationDescriptor Format(string? format) return Self; } + /// + /// Limits the histogram to specified bounds. + /// + public DateHistogramAggregationDescriptor HardBounds(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsDate? hardBounds) + { + HardBoundsDescriptor = null; + HardBoundsDescriptorAction = null; + HardBoundsValue = hardBounds; + return Self; + } + + public DateHistogramAggregationDescriptor HardBounds(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsDateDescriptor descriptor) + { + HardBoundsValue = null; + HardBoundsDescriptorAction = null; + HardBoundsDescriptor = descriptor; + return Self; + } + + public DateHistogramAggregationDescriptor HardBounds(Action configure) + { + HardBoundsValue = null; + HardBoundsDescriptor = null; + HardBoundsDescriptorAction = configure; + return Self; + } + /// /// Only returns buckets that have `min_doc_count` number of documents.
By default, all buckets between the first bucket that matches documents and the last one are returned.
///
@@ -436,6 +600,22 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o JsonSerializer.Serialize(writer, CalendarIntervalValue, options); } + if (ExtendedBoundsDescriptor is not null) + { + writer.WritePropertyName("extended_bounds"); + JsonSerializer.Serialize(writer, ExtendedBoundsDescriptor, options); + } + else if (ExtendedBoundsDescriptorAction is not null) + { + writer.WritePropertyName("extended_bounds"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsDateDescriptor(ExtendedBoundsDescriptorAction), options); + } + else if (ExtendedBoundsValue is not null) + { + writer.WritePropertyName("extended_bounds"); + JsonSerializer.Serialize(writer, ExtendedBoundsValue, options); + } + if (FieldValue is not null) { writer.WritePropertyName("field"); @@ -454,6 +634,22 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o writer.WriteStringValue(FormatValue); } + if (HardBoundsDescriptor is not null) + { + writer.WritePropertyName("hard_bounds"); + JsonSerializer.Serialize(writer, HardBoundsDescriptor, options); + } + else if (HardBoundsDescriptorAction is not null) + { + writer.WritePropertyName("hard_bounds"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsDateDescriptor(HardBoundsDescriptorAction), options); + } + else if (HardBoundsValue is not null) + { + writer.WritePropertyName("hard_bounds"); + JsonSerializer.Serialize(writer, HardBoundsValue, options); + } + if (MinDocCountValue.HasValue) { writer.WritePropertyName("min_doc_count"); diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ExtendedBoundsDate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ExtendedBoundsDate.g.cs new file mode 100644 index 00000000000..325c1685fd5 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ExtendedBoundsDate.g.cs @@ -0,0 +1,91 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Aggregations; + +public sealed partial class ExtendedBoundsDate +{ + /// + /// Maximum value for the bound. + /// + [JsonInclude, JsonPropertyName("max")] + public Elastic.Clients.Elasticsearch.Aggregations.FieldDateMath? Max { get; set; } + + /// + /// Minimum value for the bound. + /// + [JsonInclude, JsonPropertyName("min")] + public Elastic.Clients.Elasticsearch.Aggregations.FieldDateMath? Min { get; set; } +} + +public sealed partial class ExtendedBoundsDateDescriptor : SerializableDescriptor +{ + internal ExtendedBoundsDateDescriptor(Action configure) => configure.Invoke(this); + + public ExtendedBoundsDateDescriptor() : base() + { + } + + private Elastic.Clients.Elasticsearch.Aggregations.FieldDateMath? MaxValue { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.FieldDateMath? MinValue { get; set; } + + /// + /// Maximum value for the bound. + /// + public ExtendedBoundsDateDescriptor Max(Elastic.Clients.Elasticsearch.Aggregations.FieldDateMath? max) + { + MaxValue = max; + return Self; + } + + /// + /// Minimum value for the bound. + /// + public ExtendedBoundsDateDescriptor Min(Elastic.Clients.Elasticsearch.Aggregations.FieldDateMath? min) + { + MinValue = min; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (MaxValue is not null) + { + writer.WritePropertyName("max"); + JsonSerializer.Serialize(writer, MaxValue, options); + } + + if (MinValue is not null) + { + writer.WritePropertyName("min"); + JsonSerializer.Serialize(writer, MinValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ExtendedBoundsFloat.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ExtendedBoundsFloat.g.cs new file mode 100644 index 00000000000..b8b20fcb67a --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ExtendedBoundsFloat.g.cs @@ -0,0 +1,91 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Aggregations; + +public sealed partial class ExtendedBoundsFloat +{ + /// + /// Maximum value for the bound. + /// + [JsonInclude, JsonPropertyName("max")] + public float? Max { get; set; } + + /// + /// Minimum value for the bound. + /// + [JsonInclude, JsonPropertyName("min")] + public float? Min { get; set; } +} + +public sealed partial class ExtendedBoundsFloatDescriptor : SerializableDescriptor +{ + internal ExtendedBoundsFloatDescriptor(Action configure) => configure.Invoke(this); + + public ExtendedBoundsFloatDescriptor() : base() + { + } + + private float? MaxValue { get; set; } + private float? MinValue { get; set; } + + /// + /// Maximum value for the bound. + /// + public ExtendedBoundsFloatDescriptor Max(float? max) + { + MaxValue = max; + return Self; + } + + /// + /// Minimum value for the bound. + /// + public ExtendedBoundsFloatDescriptor Min(float? min) + { + MinValue = min; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (MaxValue.HasValue) + { + writer.WritePropertyName("max"); + writer.WriteNumberValue(MaxValue.Value); + } + + if (MinValue.HasValue) + { + writer.WritePropertyName("min"); + writer.WriteNumberValue(MinValue.Value); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file 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 03a59a92126..7d7f52a5561 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/HistogramAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/HistogramAggregation.g.cs @@ -29,6 +29,12 @@ namespace Elastic.Clients.Elasticsearch.Aggregations; public sealed partial class HistogramAggregation { + /// + /// Enables extending the bounds of the histogram beyond the data itself. + /// + [JsonInclude, JsonPropertyName("extended_bounds")] + public Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsFloat? ExtendedBounds { get; set; } + /// /// The name of the field to aggregate on. /// @@ -37,6 +43,12 @@ public sealed partial class HistogramAggregation [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } + /// + /// Limits the range of buckets in the histogram.
It is particularly useful in the case of open data ranges that can result in a very large number of buckets.
+ ///
+ [JsonInclude, JsonPropertyName("hard_bounds")] + public Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsFloat? HardBounds { get; set; } + /// /// The interval for the buckets.
Must be a positive decimal.
///
@@ -82,8 +94,14 @@ public HistogramAggregationDescriptor() : base() { } + private Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsFloat? ExtendedBoundsValue { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsFloatDescriptor ExtendedBoundsDescriptor { get; set; } + private Action ExtendedBoundsDescriptorAction { get; set; } private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } private string? FormatValue { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsFloat? HardBoundsValue { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsFloatDescriptor HardBoundsDescriptor { get; set; } + private Action HardBoundsDescriptorAction { get; set; } private double? IntervalValue { get; set; } private int? MinDocCountValue { get; set; } private double? MissingValue { get; set; } @@ -91,6 +109,33 @@ public HistogramAggregationDescriptor() : base() private ICollection>? OrderValue { get; set; } private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } + /// + /// Enables extending the bounds of the histogram beyond the data itself. + /// + public HistogramAggregationDescriptor ExtendedBounds(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsFloat? extendedBounds) + { + ExtendedBoundsDescriptor = null; + ExtendedBoundsDescriptorAction = null; + ExtendedBoundsValue = extendedBounds; + return Self; + } + + public HistogramAggregationDescriptor ExtendedBounds(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsFloatDescriptor descriptor) + { + ExtendedBoundsValue = null; + ExtendedBoundsDescriptorAction = null; + ExtendedBoundsDescriptor = descriptor; + return Self; + } + + public HistogramAggregationDescriptor ExtendedBounds(Action configure) + { + ExtendedBoundsValue = null; + ExtendedBoundsDescriptor = null; + ExtendedBoundsDescriptorAction = configure; + return Self; + } + /// /// The name of the field to aggregate on. /// @@ -124,6 +169,33 @@ public HistogramAggregationDescriptor Format(string? format) return Self; } + /// + /// Limits the range of buckets in the histogram.
It is particularly useful in the case of open data ranges that can result in a very large number of buckets.
+ ///
+ public HistogramAggregationDescriptor HardBounds(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsFloat? hardBounds) + { + HardBoundsDescriptor = null; + HardBoundsDescriptorAction = null; + HardBoundsValue = hardBounds; + return Self; + } + + public HistogramAggregationDescriptor HardBounds(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsFloatDescriptor descriptor) + { + HardBoundsValue = null; + HardBoundsDescriptorAction = null; + HardBoundsDescriptor = descriptor; + return Self; + } + + public HistogramAggregationDescriptor HardBounds(Action configure) + { + HardBoundsValue = null; + HardBoundsDescriptor = null; + HardBoundsDescriptorAction = configure; + return Self; + } + /// /// The interval for the buckets.
Must be a positive decimal.
///
@@ -178,6 +250,22 @@ public HistogramAggregationDescriptor Script(Elastic.Clients.Elastics protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) { writer.WriteStartObject(); + if (ExtendedBoundsDescriptor is not null) + { + writer.WritePropertyName("extended_bounds"); + JsonSerializer.Serialize(writer, ExtendedBoundsDescriptor, options); + } + else if (ExtendedBoundsDescriptorAction is not null) + { + writer.WritePropertyName("extended_bounds"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsFloatDescriptor(ExtendedBoundsDescriptorAction), options); + } + else if (ExtendedBoundsValue is not null) + { + writer.WritePropertyName("extended_bounds"); + JsonSerializer.Serialize(writer, ExtendedBoundsValue, options); + } + if (FieldValue is not null) { writer.WritePropertyName("field"); @@ -190,6 +278,22 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o writer.WriteStringValue(FormatValue); } + if (HardBoundsDescriptor is not null) + { + writer.WritePropertyName("hard_bounds"); + JsonSerializer.Serialize(writer, HardBoundsDescriptor, options); + } + else if (HardBoundsDescriptorAction is not null) + { + writer.WritePropertyName("hard_bounds"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsFloatDescriptor(HardBoundsDescriptorAction), options); + } + else if (HardBoundsValue is not null) + { + writer.WritePropertyName("hard_bounds"); + JsonSerializer.Serialize(writer, HardBoundsValue, options); + } + if (IntervalValue.HasValue) { writer.WritePropertyName("interval"); @@ -238,8 +342,14 @@ public HistogramAggregationDescriptor() : base() { } + private Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsFloat? ExtendedBoundsValue { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsFloatDescriptor ExtendedBoundsDescriptor { get; set; } + private Action ExtendedBoundsDescriptorAction { get; set; } private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } private string? FormatValue { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsFloat? HardBoundsValue { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsFloatDescriptor HardBoundsDescriptor { get; set; } + private Action HardBoundsDescriptorAction { get; set; } private double? IntervalValue { get; set; } private int? MinDocCountValue { get; set; } private double? MissingValue { get; set; } @@ -247,6 +357,33 @@ public HistogramAggregationDescriptor() : base() private ICollection>? OrderValue { get; set; } private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } + /// + /// Enables extending the bounds of the histogram beyond the data itself. + /// + public HistogramAggregationDescriptor ExtendedBounds(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsFloat? extendedBounds) + { + ExtendedBoundsDescriptor = null; + ExtendedBoundsDescriptorAction = null; + ExtendedBoundsValue = extendedBounds; + return Self; + } + + public HistogramAggregationDescriptor ExtendedBounds(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsFloatDescriptor descriptor) + { + ExtendedBoundsValue = null; + ExtendedBoundsDescriptorAction = null; + ExtendedBoundsDescriptor = descriptor; + return Self; + } + + public HistogramAggregationDescriptor ExtendedBounds(Action configure) + { + ExtendedBoundsValue = null; + ExtendedBoundsDescriptor = null; + ExtendedBoundsDescriptorAction = configure; + return Self; + } + /// /// The name of the field to aggregate on. /// @@ -280,6 +417,33 @@ public HistogramAggregationDescriptor Format(string? format) return Self; } + /// + /// Limits the range of buckets in the histogram.
It is particularly useful in the case of open data ranges that can result in a very large number of buckets.
+ ///
+ public HistogramAggregationDescriptor HardBounds(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsFloat? hardBounds) + { + HardBoundsDescriptor = null; + HardBoundsDescriptorAction = null; + HardBoundsValue = hardBounds; + return Self; + } + + public HistogramAggregationDescriptor HardBounds(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsFloatDescriptor descriptor) + { + HardBoundsValue = null; + HardBoundsDescriptorAction = null; + HardBoundsDescriptor = descriptor; + return Self; + } + + public HistogramAggregationDescriptor HardBounds(Action configure) + { + HardBoundsValue = null; + HardBoundsDescriptor = null; + HardBoundsDescriptorAction = configure; + return Self; + } + /// /// The interval for the buckets.
Must be a positive decimal.
///
@@ -334,6 +498,22 @@ public HistogramAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Scrip protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) { writer.WriteStartObject(); + if (ExtendedBoundsDescriptor is not null) + { + writer.WritePropertyName("extended_bounds"); + JsonSerializer.Serialize(writer, ExtendedBoundsDescriptor, options); + } + else if (ExtendedBoundsDescriptorAction is not null) + { + writer.WritePropertyName("extended_bounds"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsFloatDescriptor(ExtendedBoundsDescriptorAction), options); + } + else if (ExtendedBoundsValue is not null) + { + writer.WritePropertyName("extended_bounds"); + JsonSerializer.Serialize(writer, ExtendedBoundsValue, options); + } + if (FieldValue is not null) { writer.WritePropertyName("field"); @@ -346,6 +526,22 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o writer.WriteStringValue(FormatValue); } + if (HardBoundsDescriptor is not null) + { + writer.WritePropertyName("hard_bounds"); + JsonSerializer.Serialize(writer, HardBoundsDescriptor, options); + } + else if (HardBoundsDescriptorAction is not null) + { + writer.WritePropertyName("hard_bounds"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsFloatDescriptor(HardBoundsDescriptorAction), options); + } + else if (HardBoundsValue is not null) + { + writer.WritePropertyName("hard_bounds"); + JsonSerializer.Serialize(writer, HardBoundsValue, options); + } + if (IntervalValue.HasValue) { writer.WritePropertyName("interval");