diff --git a/exclusion.dic b/exclusion.dic index 56ab4f7f2b3..c62eea6303e 100644 --- a/exclusion.dic +++ b/exclusion.dic @@ -1,9 +1,9 @@ deserialize json -async inferrer elasticsearch asciidocs yyyy enum -trippable \ No newline at end of file +trippable +geotile \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/Types/Aggregations/AggregateDictionary.cs b/src/Elastic.Clients.Elasticsearch/Types/Aggregations/AggregateDictionary.cs deleted file mode 100644 index 196cea2878b..00000000000 --- a/src/Elastic.Clients.Elasticsearch/Types/Aggregations/AggregateDictionary.cs +++ /dev/null @@ -1,11 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -namespace Elastic.Clients.Elasticsearch.Aggregations; - -public partial class AggregateDictionary -{ - /// - public AvgAggregate? GetAverage(string key) => TryGet(key); -} diff --git a/src/Elastic.Clients.Elasticsearch/Types/Aggregations/AggregateDictionaryConverter.cs b/src/Elastic.Clients.Elasticsearch/Types/Aggregations/AggregateDictionaryConverter.cs index 8a5aeda2061..39fe015c96f 100644 --- a/src/Elastic.Clients.Elasticsearch/Types/Aggregations/AggregateDictionaryConverter.cs +++ b/src/Elastic.Clients.Elasticsearch/Types/Aggregations/AggregateDictionaryConverter.cs @@ -74,9 +74,6 @@ public static void ReadAggregate(ref Utf8JsonReader reader, JsonSerializerOption break; } - case "categorize_text": - throw new Exception("The aggregate in response is not yet supported"); - case "children": { var agg = JsonSerializer.Deserialize(ref reader, options); @@ -105,9 +102,6 @@ public static void ReadAggregate(ref Utf8JsonReader reader, JsonSerializerOption break; } - case "diversified_sampler": - throw new Exception("The aggregate in response is not yet supported"); - case "filter": { var agg = JsonSerializer.Deserialize(ref reader, options); @@ -122,26 +116,26 @@ public static void ReadAggregate(ref Utf8JsonReader reader, JsonSerializerOption break; } - //case "geo_distance": - // { - // var agg = JsonSerializer.Deserialize(ref reader, options); - // dictionary.Add(nameParts[1], agg); - // break; - // } + case "geo_distance": + { + var agg = JsonSerializer.Deserialize(ref reader, options); + dictionary.Add(nameParts[1], agg); + break; + } - //case "geohash_grid": - // { - // var agg = JsonSerializer.Deserialize(ref reader, options); - // dictionary.Add(nameParts[1], agg); - // break; - // } + case "geohash_grid": + { + var agg = JsonSerializer.Deserialize(ref reader, options); + dictionary.Add(nameParts[1], agg); + break; + } - //case "geotile_grid": - // { - // var agg = JsonSerializer.Deserialize(ref reader, options); - // dictionary.Add(nameParts[1], agg); - // break; - // } + case "geotile_grid": + { + var agg = JsonSerializer.Deserialize(ref reader, options); + dictionary.Add(nameParts[1], agg); + break; + } case "global": { @@ -164,6 +158,13 @@ public static void ReadAggregate(ref Utf8JsonReader reader, JsonSerializerOption break; } + case "ip_prefix": + { + var agg = JsonSerializer.Deserialize(ref reader, options); + dictionary.Add(nameParts[1], agg); + break; + } + case "missing": { var agg = JsonSerializer.Deserialize(ref reader, options); @@ -199,9 +200,6 @@ public static void ReadAggregate(ref Utf8JsonReader reader, JsonSerializerOption break; } - case "rare_terms": - throw new Exception("The aggregate in response is not yet supported"); - case "reverse_nested": { var agg = JsonSerializer.Deserialize(ref reader, options); @@ -216,11 +214,12 @@ public static void ReadAggregate(ref Utf8JsonReader reader, JsonSerializerOption break; } - case "significant_terms": - throw new Exception("The aggregate in response is not yet supported"); - - case "significant_text": - throw new Exception("The aggregate in response is not yet supported"); + case "sigsterms": + { + var agg = JsonSerializer.Deserialize(ref reader, options); + dictionary.Add(nameParts[1], agg); + break; + } case "variable_width_histogram": { @@ -231,14 +230,14 @@ public static void ReadAggregate(ref Utf8JsonReader reader, JsonSerializerOption case "avg": { - var agg = JsonSerializer.Deserialize(ref reader, options); + var agg = JsonSerializer.Deserialize(ref reader, options); dictionary.Add(nameParts[1], agg); break; } case "boxplot": { - var agg = JsonSerializer.Deserialize(ref reader, options); + var agg = JsonSerializer.Deserialize(ref reader, options); dictionary.Add(nameParts[1], agg); break; } @@ -278,6 +277,13 @@ public static void ReadAggregate(ref Utf8JsonReader reader, JsonSerializerOption // break; // } + case "srareterms": + { + var agg = JsonSerializer.Deserialize(ref reader, options); + dictionary.Add(nameParts[1], agg); + break; + } + case "matrix_stats": { var agg = JsonSerializer.Deserialize(ref reader, options); @@ -306,9 +312,6 @@ public static void ReadAggregate(ref Utf8JsonReader reader, JsonSerializerOption break; } - case "percentile_ranks": - throw new Exception("The aggregate in response is not yet supported."); - case "tdigest_percentile_ranks": { var agg = JsonSerializer.Deserialize(ref reader, options); @@ -316,9 +319,6 @@ public static void ReadAggregate(ref Utf8JsonReader reader, JsonSerializerOption break; } - case "percentiles": - throw new Exception("The aggregate in response is not yet supported."); - case "rate": { var agg = JsonSerializer.Deserialize(ref reader, options); @@ -384,22 +384,11 @@ public static void ReadAggregate(ref Utf8JsonReader reader, JsonSerializerOption case "weighted_avg": { - var agg = JsonSerializer.Deserialize(ref reader, options); + var agg = JsonSerializer.Deserialize(ref reader, options); dictionary.Add(nameParts[1], agg); break; } - case "avg_bucket": - throw new Exception("The aggregate in response is not yet supported."); - case "bucket_script": - throw new Exception("The aggregate in response is not yet supported."); - case "bucket_count_ks_test": - throw new Exception("The aggregate in response is not yet supported."); - case "bucket_correlation": - throw new Exception("The aggregate in response is not yet supported."); - case "bucket_selector": - throw new Exception("The aggregate in response is not yet supported."); - case "cumulative_cardinality": { var agg = JsonSerializer.Deserialize(ref reader, options); @@ -436,20 +425,6 @@ public static void ReadAggregate(ref Utf8JsonReader reader, JsonSerializerOption dictionary.Add(nameParts[1], agg); break; } - - case "max_bucket": - throw new Exception("The aggregate in response is not yet supported."); - case "min_bucket": - throw new Exception("The aggregate in response is not yet supported."); - case "moving_avg": - throw new Exception("The aggregate in response is not yet supported."); - case "moving_fn": - throw new Exception("The aggregate in response is not yet supported."); - case "moving_percentiles": - throw new Exception("The aggregate in response is not yet supported."); - case "normalize": - throw new Exception("The aggregate in response is not yet supported."); - case "percentiles_bucket": { var agg = JsonSerializer.Deserialize(ref reader, options); @@ -457,9 +432,6 @@ public static void ReadAggregate(ref Utf8JsonReader reader, JsonSerializerOption break; } - case "serial_diff": - throw new Exception("The aggregate in response is not yet supported."); - case "stats_bucket": { var agg = JsonSerializer.Deserialize(ref reader, options); @@ -467,11 +439,8 @@ public static void ReadAggregate(ref Utf8JsonReader reader, JsonSerializerOption break; } - case "sum_bucket": - throw new Exception("The aggregate in response is not yet supported."); - default: - throw new Exception("The aggregate in response is not yet supported."); + throw new Exception($"The aggregate '{aggregateName}' in this response is not currently supported."); } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.AsyncSearch.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.AsyncSearch.g.cs index fa8d5e71242..1b16ca5d58a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.AsyncSearch.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.AsyncSearch.g.cs @@ -38,7 +38,7 @@ internal AsyncSearchNamespacedClient(ElasticsearchClient client) : base(client) /// /// Retrieves the status of a previously submitted async search request given its ID. - /// Learn more about this API in the Elasticsearch documentation. + /// Learn more about this API in the Elasticsearch documentation. /// public virtual AsyncSearchStatusResponse Status(AsyncSearchStatusRequest request) { @@ -48,7 +48,7 @@ public virtual AsyncSearchStatusResponse Status(AsyncSearchStatusRequest request /// /// Retrieves the status of a previously submitted async search request given its ID. - /// Learn more about this API in the Elasticsearch documentation. + /// Learn more about this API in the Elasticsearch documentation. /// public virtual Task StatusAsync(AsyncSearchStatusRequest request, CancellationToken cancellationToken = default) { @@ -104,7 +104,7 @@ public virtual Task StatusAsync(Elastic.Cl /// /// Deletes an async search by ID. If the search is still running, the search request will be cancelled. Otherwise, the saved search results are deleted. - /// Learn more about this API in the Elasticsearch documentation. + /// Learn more about this API in the Elasticsearch documentation. /// public virtual DeleteAsyncSearchResponse Delete(DeleteAsyncSearchRequest request) { @@ -114,7 +114,7 @@ public virtual DeleteAsyncSearchResponse Delete(DeleteAsyncSearchRequest request /// /// Deletes an async search by ID. If the search is still running, the search request will be cancelled. Otherwise, the saved search results are deleted. - /// Learn more about this API in the Elasticsearch documentation. + /// Learn more about this API in the Elasticsearch documentation. /// public virtual Task DeleteAsync(DeleteAsyncSearchRequest request, CancellationToken cancellationToken = default) { @@ -170,7 +170,7 @@ public virtual Task DeleteAsync(Elastic.Cl /// /// Retrieves the results of a previously submitted async search request given its ID. - /// Learn more about this API in the Elasticsearch documentation. + /// Learn more about this API in the Elasticsearch documentation. /// public virtual GetAsyncSearchResponse Get(GetAsyncSearchRequest request) { @@ -180,7 +180,7 @@ public virtual GetAsyncSearchResponse Get(GetAsyncSearchRe /// /// Retrieves the results of a previously submitted async search request given its ID. - /// Learn more about this API in the Elasticsearch documentation. + /// Learn more about this API in the Elasticsearch documentation. /// public virtual Task> GetAsync(GetAsyncSearchRequest request, CancellationToken cancellationToken = default) { @@ -220,7 +220,7 @@ public virtual Task> GetAsync(Elast /// /// Executes a search request asynchronously. - /// Learn more about this API in the Elasticsearch documentation. + /// Learn more about this API in the Elasticsearch documentation. /// public virtual SubmitAsyncSearchResponse Submit(SubmitAsyncSearchRequest request) { @@ -230,7 +230,7 @@ public virtual SubmitAsyncSearchResponse Submit(SubmitAsyn /// /// Executes a search request asynchronously. - /// Learn more about this API in the Elasticsearch documentation. + /// Learn more about this API in the Elasticsearch documentation. /// public virtual Task> SubmitAsync(SubmitAsyncSearchRequest request, CancellationToken cancellationToken = default) { diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Cluster.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Cluster.g.cs index 0d37b79f8a8..4c63cb22112 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Cluster.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Cluster.g.cs @@ -38,7 +38,7 @@ internal ClusterNamespacedClient(ElasticsearchClient client) : base(client) /// /// Returns basic information about the health of the cluster. - /// Learn more about this API in the Elasticsearch documentation. + /// Learn more about this API in the Elasticsearch documentation. /// public virtual HealthResponse Health(HealthRequest request) { @@ -48,7 +48,7 @@ public virtual HealthResponse Health(HealthRequest request) /// /// Returns basic information about the health of the cluster. - /// Learn more about this API in the Elasticsearch documentation. + /// Learn more about this API in the Elasticsearch documentation. /// public virtual Task HealthAsync(HealthRequest request, CancellationToken cancellationToken = default) { diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.g.cs index 689272d1b64..aef1ce9831a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.g.cs @@ -45,7 +45,7 @@ private partial void SetupNamespaces() /// /// Allows to perform multiple index/update/delete operations in a single request. - /// Learn more about this API in the Elasticsearch documentation. + /// Learn more about this API in the Elasticsearch documentation. /// public virtual BulkResponse Bulk(BulkRequest request) { @@ -55,7 +55,7 @@ public virtual BulkResponse Bulk(BulkRequest request) /// /// Allows to perform multiple index/update/delete operations in a single request. - /// Learn more about this API in the Elasticsearch documentation. + /// Learn more about this API in the Elasticsearch documentation. /// public virtual Task BulkAsync(BulkRequest request, CancellationToken cancellationToken = default) { @@ -111,7 +111,7 @@ public virtual Task BulkAsync(Action /// Explicitly clears the search context for a scroll. - /// Learn more about this API in the Elasticsearch documentation. + /// Learn more about this API in the Elasticsearch documentation. /// public virtual ClearScrollResponse ClearScroll(ClearScrollRequest request) { @@ -121,7 +121,7 @@ public virtual ClearScrollResponse ClearScroll(ClearScrollRequest request) /// /// Explicitly clears the search context for a scroll. - /// Learn more about this API in the Elasticsearch documentation. + /// Learn more about this API in the Elasticsearch documentation. /// public virtual Task ClearScrollAsync(ClearScrollRequest request, CancellationToken cancellationToken = default) { @@ -161,7 +161,7 @@ public virtual Task ClearScrollAsync(Action /// Close a point in time - /// Learn more about this API in the Elasticsearch documentation. + /// Learn more about this API in the Elasticsearch documentation. /// public virtual ClosePointInTimeResponse ClosePointInTime(ClosePointInTimeRequest request) { @@ -171,7 +171,7 @@ public virtual ClosePointInTimeResponse ClosePointInTime(ClosePointInTimeRequest /// /// Close a point in time - /// Learn more about this API in the Elasticsearch documentation. + /// Learn more about this API in the Elasticsearch documentation. /// public virtual Task ClosePointInTimeAsync(ClosePointInTimeRequest request, CancellationToken cancellationToken = default) { @@ -1581,7 +1581,7 @@ public virtual Task> MultiSearchTemplateA /// /// Open a point in time that can be used in subsequent searches - /// Learn more about this API in the Elasticsearch documentation. + /// Learn more about this API in the Elasticsearch documentation. /// public virtual OpenPointInTimeResponse OpenPointInTime(OpenPointInTimeRequest request) { @@ -1591,7 +1591,7 @@ public virtual OpenPointInTimeResponse OpenPointInTime(OpenPointInTimeRequest re /// /// Open a point in time that can be used in subsequent searches - /// Learn more about this API in the Elasticsearch documentation. + /// Learn more about this API in the Elasticsearch documentation. /// public virtual Task OpenPointInTimeAsync(OpenPointInTimeRequest request, CancellationToken cancellationToken = default) { diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AggregateDictionary.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AggregateDictionary.g.cs index c4988260fb6..9f286fbc7ad 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AggregateDictionary.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AggregateDictionary.g.cs @@ -44,8 +44,8 @@ public AggregateDictionary(IReadOnlyDictionary backingDictio public Elastic.Clients.Elasticsearch.Aggregations.MinAggregate? GetMin(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.MaxAggregate? GetMax(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.SumAggregate? GetSum(string key) => TryGet(key); - public Elastic.Clients.Elasticsearch.Aggregations.AvgAggregate? GetAvg(string key) => TryGet(key); - public Elastic.Clients.Elasticsearch.Aggregations.WeightedAvgAggregate? GetWeightedAvg(string key) => TryGet(key); + public Elastic.Clients.Elasticsearch.Aggregations.AverageAggregate? GetAverage(string key) => TryGet(key); + public Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregate? GetWeightedAverage(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregate? GetValueCount(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.DerivativeAggregate? GetDerivative(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.StatsAggregate? GetStats(string key) => TryGet(key); @@ -59,6 +59,7 @@ public AggregateDictionary(IReadOnlyDictionary backingDictio public Elastic.Clients.Elasticsearch.Aggregations.StringTermsAggregate? GetStringTerms(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.LongTermsAggregate? GetLongTerms(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.DoubleTermsAggregate? GetDoubleTerms(string key) => TryGet(key); + public Elastic.Clients.Elasticsearch.Aggregations.StringRareTermsAggregate? GetStringRareTerms(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregate? GetMultiTerms(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.MissingAggregate? GetMissing(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.NestedAggregate? GetNested(string key) => TryGet(key); @@ -68,17 +69,23 @@ public AggregateDictionary(IReadOnlyDictionary backingDictio public Elastic.Clients.Elasticsearch.Aggregations.ChildrenAggregate? GetChildren(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.ParentAggregate? GetParent(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregate? GetSampler(string key) => TryGet(key); + public Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregate? GetGeohashGrid(string key) => TryGet(key); + public Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregate? GetGeotileGrid(string key) => TryGet(key); + public Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregate? GetGeohexGrid(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.RangeAggregate? GetRange(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregate? GetDateRange(string key) => TryGet(key); + public Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregate? GetGeoDistance(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregate? GetIpRange(string key) => TryGet(key); + public Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregate? GetIpPrefix(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregate? GetFilters(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregate? GetAdjacencyMatrix(string key) => TryGet(key); + public Elastic.Clients.Elasticsearch.Aggregations.SignificantStringTermsAggregate? GetSignificantStringTerms(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregate? GetComposite(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregate? GetScriptedMetric(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregate? GetTopHits(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregate? GetInference(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregate? GetStringStats(string key) => TryGet(key); - public Elastic.Clients.Elasticsearch.Aggregations.BoxPlotAggregate? GetBoxPlot(string key) => TryGet(key); + public Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregate? GetBoxplot(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregate? GetTopMetrics(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.TTestAggregate? GetTTest(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.RateAggregate? GetRate(string key) => TryGet(key); diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/Aggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/Aggregation.g.cs index 42ca53549a8..b6492641c1c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/Aggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/Aggregation.g.cs @@ -112,6 +112,11 @@ public override Aggregation Read(ref Utf8JsonReader reader, Type typeToConvert, return AggregationSerializationHelper.ReadContainer("derivative", ref reader, options); } + if (propertyName == "diversified_sampler") + { + return AggregationSerializationHelper.ReadContainer("diversified_sampler", ref reader, options); + } + if (propertyName == "extended_stats") { return AggregationSerializationHelper.ReadContainer("extended_stats", ref reader, options); @@ -127,6 +132,26 @@ public override Aggregation Read(ref Utf8JsonReader reader, Type typeToConvert, return AggregationSerializationHelper.ReadContainer("filters", ref reader, options); } + if (propertyName == "geo_distance") + { + return AggregationSerializationHelper.ReadContainer("geo_distance", ref reader, options); + } + + if (propertyName == "geohash_grid") + { + return AggregationSerializationHelper.ReadContainer("geohash_grid", ref reader, options); + } + + if (propertyName == "geohex_grid") + { + return AggregationSerializationHelper.ReadContainer("geohex_grid", ref reader, options); + } + + if (propertyName == "geotile_grid") + { + return AggregationSerializationHelper.ReadContainer("geotile_grid", ref reader, options); + } + if (propertyName == "global") { return AggregationSerializationHelper.ReadContainer("global", ref reader, options); @@ -142,6 +167,11 @@ public override Aggregation Read(ref Utf8JsonReader reader, Type typeToConvert, return AggregationSerializationHelper.ReadContainer("inference", ref reader, options); } + if (propertyName == "ip_prefix") + { + return AggregationSerializationHelper.ReadContainer("ip_prefix", ref reader, options); + } + if (propertyName == "ip_range") { return AggregationSerializationHelper.ReadContainer("ip_range", ref reader, options); @@ -197,6 +227,11 @@ public override Aggregation Read(ref Utf8JsonReader reader, Type typeToConvert, return AggregationSerializationHelper.ReadContainer("range", ref reader, options); } + if (propertyName == "rare_terms") + { + return AggregationSerializationHelper.ReadContainer("rare_terms", ref reader, options); + } + if (propertyName == "rate") { return AggregationSerializationHelper.ReadContainer("rate", ref reader, options); @@ -217,6 +252,11 @@ public override Aggregation Read(ref Utf8JsonReader reader, Type typeToConvert, return AggregationSerializationHelper.ReadContainer("scripted_metric", ref reader, options); } + if (propertyName == "significant_terms") + { + return AggregationSerializationHelper.ReadContainer("significant_terms", ref reader, options); + } + if (propertyName == "stats") { return AggregationSerializationHelper.ReadContainer("stats", ref reader, options); @@ -370,6 +410,11 @@ public AggregationDescriptor Derivative(string name, Action DiversifiedSampler(string name, Action> configure) + { + return SetContainer(name, Aggregation.CreateWithAction("diversified_sampler", configure)); + } + public AggregationDescriptor ExtendedStats(string name, Action> configure) { return SetContainer(name, Aggregation.CreateWithAction("extended_stats", configure)); @@ -385,6 +430,26 @@ public AggregationDescriptor Filters(string name, Action GeoDistance(string name, Action> configure) + { + return SetContainer(name, Aggregation.CreateWithAction("geo_distance", configure)); + } + + public AggregationDescriptor GeohashGrid(string name, Action> configure) + { + return SetContainer(name, Aggregation.CreateWithAction("geohash_grid", configure)); + } + + public AggregationDescriptor GeohexGrid(string name, Action> configure) + { + return SetContainer(name, Aggregation.CreateWithAction("geohex_grid", configure)); + } + + public AggregationDescriptor GeotileGrid(string name, Action> configure) + { + return SetContainer(name, Aggregation.CreateWithAction("geotile_grid", configure)); + } + public AggregationDescriptor Global(string name, Action> configure) { return SetContainer(name, Aggregation.CreateWithAction("global", configure)); @@ -400,6 +465,11 @@ public AggregationDescriptor Inference(string name, Action IpPrefix(string name, Action> configure) + { + return SetContainer(name, Aggregation.CreateWithAction("ip_prefix", configure)); + } + public AggregationDescriptor IpRange(string name, Action> configure) { return SetContainer(name, Aggregation.CreateWithAction("ip_range", configure)); @@ -455,6 +525,11 @@ public AggregationDescriptor Range(string name, Action RareTerms(string name, Action> configure) + { + return SetContainer(name, Aggregation.CreateWithAction("rare_terms", configure)); + } + public AggregationDescriptor Rate(string name, Action> configure) { return SetContainer(name, Aggregation.CreateWithAction("rate", configure)); @@ -475,6 +550,11 @@ public AggregationDescriptor ScriptedMetric(string name, Action SignificantTerms(string name, Action> configure) + { + return SetContainer(name, Aggregation.CreateWithAction("significant_terms", configure)); + } + public AggregationDescriptor Stats(string name, Action> configure) { return SetContainer(name, Aggregation.CreateWithAction("stats", configure)); @@ -654,6 +734,16 @@ public AggregationDescriptor Derivative(string name, Action configure) + { + return SetContainer(name, Aggregation.CreateWithAction("diversified_sampler", configure)); + } + + public AggregationDescriptor DiversifiedSampler(string name, Action> configure) + { + return SetContainer(name, Aggregation.CreateWithAction("diversified_sampler", configure)); + } + public AggregationDescriptor ExtendedStats(string name, Action configure) { return SetContainer(name, Aggregation.CreateWithAction("extended_stats", configure)); @@ -679,6 +769,46 @@ public AggregationDescriptor Filters(string name, Action configure) + { + return SetContainer(name, Aggregation.CreateWithAction("geo_distance", configure)); + } + + public AggregationDescriptor GeoDistance(string name, Action> configure) + { + return SetContainer(name, Aggregation.CreateWithAction("geo_distance", configure)); + } + + public AggregationDescriptor GeohashGrid(string name, Action configure) + { + return SetContainer(name, Aggregation.CreateWithAction("geohash_grid", configure)); + } + + public AggregationDescriptor GeohashGrid(string name, Action> configure) + { + return SetContainer(name, Aggregation.CreateWithAction("geohash_grid", configure)); + } + + public AggregationDescriptor GeohexGrid(string name, Action configure) + { + return SetContainer(name, Aggregation.CreateWithAction("geohex_grid", configure)); + } + + public AggregationDescriptor GeohexGrid(string name, Action> configure) + { + return SetContainer(name, Aggregation.CreateWithAction("geohex_grid", configure)); + } + + public AggregationDescriptor GeotileGrid(string name, Action configure) + { + return SetContainer(name, Aggregation.CreateWithAction("geotile_grid", configure)); + } + + public AggregationDescriptor GeotileGrid(string name, Action> configure) + { + return SetContainer(name, Aggregation.CreateWithAction("geotile_grid", configure)); + } + public AggregationDescriptor Global(string name, Action configure) { return SetContainer(name, Aggregation.CreateWithAction("global", configure)); @@ -709,6 +839,16 @@ public AggregationDescriptor Inference(string name, Action configure) + { + return SetContainer(name, Aggregation.CreateWithAction("ip_prefix", configure)); + } + + public AggregationDescriptor IpPrefix(string name, Action> configure) + { + return SetContainer(name, Aggregation.CreateWithAction("ip_prefix", configure)); + } + public AggregationDescriptor IpRange(string name, Action configure) { return SetContainer(name, Aggregation.CreateWithAction("ip_range", configure)); @@ -814,6 +954,16 @@ public AggregationDescriptor Range(string name, Action configure) + { + return SetContainer(name, Aggregation.CreateWithAction("rare_terms", configure)); + } + + public AggregationDescriptor RareTerms(string name, Action> configure) + { + return SetContainer(name, Aggregation.CreateWithAction("rare_terms", configure)); + } + public AggregationDescriptor Rate(string name, Action configure) { return SetContainer(name, Aggregation.CreateWithAction("rate", configure)); @@ -854,6 +1004,16 @@ public AggregationDescriptor ScriptedMetric(string name, Action configure) + { + return SetContainer(name, Aggregation.CreateWithAction("significant_terms", configure)); + } + + public AggregationDescriptor SignificantTerms(string name, Action> configure) + { + return SetContainer(name, Aggregation.CreateWithAction("significant_terms", configure)); + } + public AggregationDescriptor Stats(string name, Action configure) { return SetContainer(name, Aggregation.CreateWithAction("stats", configure)); diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AvgAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AverageAggregate.g.cs similarity index 96% rename from src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AvgAggregate.g.cs rename to src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AverageAggregate.g.cs index f701e338a88..4c8cc0fd99e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AvgAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AverageAggregate.g.cs @@ -27,7 +27,7 @@ namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class AvgAggregate : IAggregate +public sealed partial class AverageAggregate : IAggregate { [JsonInclude, JsonPropertyName("meta")] public IReadOnlyDictionary? Meta { get; init; } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BoxPlotAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BoxplotAggregate.g.cs similarity index 97% rename from src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BoxPlotAggregate.g.cs rename to src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BoxplotAggregate.g.cs index 10671e5eb6d..66c8eb6edfa 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BoxPlotAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BoxplotAggregate.g.cs @@ -27,7 +27,7 @@ namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class BoxPlotAggregate : IAggregate +public sealed partial class BoxplotAggregate : IAggregate { [JsonInclude, JsonPropertyName("lower")] public double Lower { get; init; } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ChiSquareHeuristic.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ChiSquareHeuristic.g.cs new file mode 100644 index 00000000000..51f0599ac49 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ChiSquareHeuristic.g.cs @@ -0,0 +1,70 @@ +// 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 ChiSquareHeuristic +{ + [JsonInclude, JsonPropertyName("background_is_superset")] + public bool BackgroundIsSuperset { get; set; } + [JsonInclude, JsonPropertyName("include_negatives")] + public bool IncludeNegatives { get; set; } +} + +public sealed partial class ChiSquareHeuristicDescriptor : SerializableDescriptor +{ + internal ChiSquareHeuristicDescriptor(Action configure) => configure.Invoke(this); + + public ChiSquareHeuristicDescriptor() : base() + { + } + + private bool BackgroundIsSupersetValue { get; set; } + private bool IncludeNegativesValue { get; set; } + + public ChiSquareHeuristicDescriptor BackgroundIsSuperset(bool backgroundIsSuperset = true) + { + BackgroundIsSupersetValue = backgroundIsSuperset; + return Self; + } + + public ChiSquareHeuristicDescriptor IncludeNegatives(bool includeNegatives = true) + { + IncludeNegativesValue = includeNegatives; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("background_is_superset"); + writer.WriteBooleanValue(BackgroundIsSupersetValue); + writer.WritePropertyName("include_negatives"); + writer.WriteBooleanValue(IncludeNegativesValue); + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CompositeAggregationSource.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CompositeAggregationSource.g.cs index 72f34113ca3..7e1ab0f7ce8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CompositeAggregationSource.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CompositeAggregationSource.g.cs @@ -31,6 +31,8 @@ public sealed partial class CompositeAggregationSource { [JsonInclude, JsonPropertyName("date_histogram")] public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregation? DateHistogram { get; set; } + [JsonInclude, JsonPropertyName("geotile_grid")] + public Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregation? GeotileGrid { get; set; } [JsonInclude, JsonPropertyName("histogram")] public Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregation? Histogram { get; set; } [JsonInclude, JsonPropertyName("terms")] @@ -48,6 +50,9 @@ public CompositeAggregationSourceDescriptor() : base() private Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregation? DateHistogramValue { get; set; } private DateHistogramAggregationDescriptor DateHistogramDescriptor { get; set; } private Action> DateHistogramDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregation? GeotileGridValue { get; set; } + private GeotileGridAggregationDescriptor GeotileGridDescriptor { get; set; } + private Action> GeotileGridDescriptorAction { get; set; } private Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregation? HistogramValue { get; set; } private HistogramAggregationDescriptor HistogramDescriptor { get; set; } private Action> HistogramDescriptorAction { get; set; } @@ -79,6 +84,30 @@ public CompositeAggregationSourceDescriptor DateHistogram(Action GeotileGrid(Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregation? geotileGrid) + { + GeotileGridDescriptor = null; + GeotileGridDescriptorAction = null; + GeotileGridValue = geotileGrid; + return Self; + } + + public CompositeAggregationSourceDescriptor GeotileGrid(GeotileGridAggregationDescriptor descriptor) + { + GeotileGridValue = null; + GeotileGridDescriptorAction = null; + GeotileGridDescriptor = descriptor; + return Self; + } + + public CompositeAggregationSourceDescriptor GeotileGrid(Action> configure) + { + GeotileGridValue = null; + GeotileGridDescriptor = null; + GeotileGridDescriptorAction = configure; + return Self; + } + public CompositeAggregationSourceDescriptor Histogram(Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregation? histogram) { HistogramDescriptor = null; @@ -146,6 +175,22 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o JsonSerializer.Serialize(writer, DateHistogramValue, options); } + if (GeotileGridDescriptor is not null) + { + writer.WritePropertyName("geotile_grid"); + JsonSerializer.Serialize(writer, GeotileGridDescriptor, options); + } + else if (GeotileGridDescriptorAction is not null) + { + writer.WritePropertyName("geotile_grid"); + JsonSerializer.Serialize(writer, new GeotileGridAggregationDescriptor(GeotileGridDescriptorAction), options); + } + else if (GeotileGridValue is not null) + { + writer.WritePropertyName("geotile_grid"); + JsonSerializer.Serialize(writer, GeotileGridValue, options); + } + if (HistogramDescriptor is not null) { writer.WritePropertyName("histogram"); @@ -193,6 +238,9 @@ public CompositeAggregationSourceDescriptor() : base() private Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregation? DateHistogramValue { get; set; } private DateHistogramAggregationDescriptor DateHistogramDescriptor { get; set; } private Action DateHistogramDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregation? GeotileGridValue { get; set; } + private GeotileGridAggregationDescriptor GeotileGridDescriptor { get; set; } + private Action GeotileGridDescriptorAction { get; set; } private Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregation? HistogramValue { get; set; } private HistogramAggregationDescriptor HistogramDescriptor { get; set; } private Action HistogramDescriptorAction { get; set; } @@ -224,6 +272,30 @@ public CompositeAggregationSourceDescriptor DateHistogram(Action configure) + { + GeotileGridValue = null; + GeotileGridDescriptor = null; + GeotileGridDescriptorAction = configure; + return Self; + } + public CompositeAggregationSourceDescriptor Histogram(Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregation? histogram) { HistogramDescriptor = null; @@ -291,6 +363,22 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o JsonSerializer.Serialize(writer, DateHistogramValue, options); } + if (GeotileGridDescriptor is not null) + { + writer.WritePropertyName("geotile_grid"); + JsonSerializer.Serialize(writer, GeotileGridDescriptor, options); + } + else if (GeotileGridDescriptorAction is not null) + { + writer.WritePropertyName("geotile_grid"); + JsonSerializer.Serialize(writer, new GeotileGridAggregationDescriptor(GeotileGridDescriptorAction), options); + } + else if (GeotileGridValue is not null) + { + writer.WritePropertyName("geotile_grid"); + JsonSerializer.Serialize(writer, GeotileGridValue, options); + } + if (HistogramDescriptor is not null) { writer.WritePropertyName("histogram"); diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CumulativeSumAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CumulativeSumAggregation.g.cs index 99b8642e243..0a0e9676bcc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CumulativeSumAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CumulativeSumAggregation.g.cs @@ -219,4 +219,4 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o writer.WriteEndObject(); } -} +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DiversifiedSamplerAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DiversifiedSamplerAggregation.g.cs new file mode 100644 index 00000000000..65f216d2f17 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DiversifiedSamplerAggregation.g.cs @@ -0,0 +1,505 @@ +// 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; + +internal sealed class DiversifiedSamplerAggregationConverter : JsonConverter +{ + public override DiversifiedSamplerAggregation Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + throw new JsonException("Unexpected JSON detected."); + reader.Read(); + var aggName = reader.GetString(); + if (aggName != "diversified_sampler") + throw new JsonException("Unexpected JSON detected."); + var agg = new DiversifiedSamplerAggregation(aggName); + while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + { + if (reader.TokenType == JsonTokenType.PropertyName) + { + if (reader.ValueTextEquals("execution_hint")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.ExecutionHint = value; + } + + continue; + } + + if (reader.ValueTextEquals("field")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.Field = value; + } + + continue; + } + + if (reader.ValueTextEquals("max_docs_per_value")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.MaxDocsPerValue = value; + } + + continue; + } + + if (reader.ValueTextEquals("script")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.Script = value; + } + + continue; + } + + if (reader.ValueTextEquals("shard_size")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.ShardSize = value; + } + + continue; + } + } + } + + while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + { + if (reader.TokenType == JsonTokenType.PropertyName) + { + if (reader.ValueTextEquals("meta")) + { + var value = JsonSerializer.Deserialize>(ref reader, options); + if (value is not null) + { + agg.Meta = value; + } + + continue; + } + + if (reader.ValueTextEquals("aggs") || reader.ValueTextEquals("aggregations")) + { + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.Aggregations = value; + } + + continue; + } + } + } + + return agg; + } + + public override void Write(Utf8JsonWriter writer, DiversifiedSamplerAggregation value, JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WritePropertyName("diversified_sampler"); + writer.WriteStartObject(); + if (value.ExecutionHint is not null) + { + writer.WritePropertyName("execution_hint"); + JsonSerializer.Serialize(writer, value.ExecutionHint, options); + } + + if (value.Field is not null) + { + writer.WritePropertyName("field"); + JsonSerializer.Serialize(writer, value.Field, options); + } + + if (value.MaxDocsPerValue.HasValue) + { + writer.WritePropertyName("max_docs_per_value"); + writer.WriteNumberValue(value.MaxDocsPerValue.Value); + } + + if (value.Script is not null) + { + writer.WritePropertyName("script"); + JsonSerializer.Serialize(writer, value.Script, options); + } + + if (value.ShardSize.HasValue) + { + writer.WritePropertyName("shard_size"); + writer.WriteNumberValue(value.ShardSize.Value); + } + + writer.WriteEndObject(); + if (value.Meta is not null) + { + writer.WritePropertyName("meta"); + JsonSerializer.Serialize(writer, value.Meta, options); + } + + if (value.Aggregations is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, value.Aggregations, options); + } + + writer.WriteEndObject(); + } +} + +[JsonConverter(typeof(DiversifiedSamplerAggregationConverter))] +public sealed partial class DiversifiedSamplerAggregation : SearchAggregation +{ + public DiversifiedSamplerAggregation(string name) => Name = name; + + internal DiversifiedSamplerAggregation() + { + } + + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDictionary? Aggregations { get; set; } + public Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregationExecutionHint? ExecutionHint { get; set; } + public Elastic.Clients.Elasticsearch.Field? Field { get; set; } + public int? MaxDocsPerValue { get; set; } + public IDictionary? Meta { get; set; } + override public string? Name { get; internal set; } + public Elastic.Clients.Elasticsearch.Script? Script { get; set; } + public int? ShardSize { get; set; } +} + +public sealed partial class DiversifiedSamplerAggregationDescriptor : SerializableDescriptor> +{ + internal DiversifiedSamplerAggregationDescriptor(Action> configure) => configure.Invoke(this); + + public DiversifiedSamplerAggregationDescriptor() : base() + { + } + + private Elastic.Clients.Elasticsearch.Aggregations.AggregationDictionary? AggregationsValue { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor AggregationsDescriptor { get; set; } + private Action> AggregationsDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregationExecutionHint? ExecutionHintValue { get; set; } + private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } + private int? MaxDocsPerValueValue { get; set; } + private IDictionary? MetaValue { get; set; } + private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } + private int? ShardSizeValue { get; set; } + + public DiversifiedSamplerAggregationDescriptor Aggregations(Elastic.Clients.Elasticsearch.Aggregations.AggregationDictionary? aggregations) + { + AggregationsDescriptor = null; + AggregationsDescriptorAction = null; + AggregationsValue = aggregations; + return Self; + } + + public DiversifiedSamplerAggregationDescriptor Aggregations(Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor descriptor) + { + AggregationsValue = null; + AggregationsDescriptorAction = null; + AggregationsDescriptor = descriptor; + return Self; + } + + public DiversifiedSamplerAggregationDescriptor Aggregations(Action> configure) + { + AggregationsValue = null; + AggregationsDescriptor = null; + AggregationsDescriptorAction = configure; + return Self; + } + + public DiversifiedSamplerAggregationDescriptor ExecutionHint(Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregationExecutionHint? executionHint) + { + ExecutionHintValue = executionHint; + return Self; + } + + public DiversifiedSamplerAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + { + FieldValue = field; + return Self; + } + + public DiversifiedSamplerAggregationDescriptor Field(Expression> field) + { + FieldValue = field; + return Self; + } + + public DiversifiedSamplerAggregationDescriptor MaxDocsPerValue(int? maxDocsPerValue) + { + MaxDocsPerValueValue = maxDocsPerValue; + return Self; + } + + public DiversifiedSamplerAggregationDescriptor Meta(Func, FluentDictionary> selector) + { + MetaValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + public DiversifiedSamplerAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + { + ScriptValue = script; + return Self; + } + + public DiversifiedSamplerAggregationDescriptor ShardSize(int? shardSize) + { + ShardSizeValue = shardSize; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("diversified_sampler"); + writer.WriteStartObject(); + if (ExecutionHintValue is not null) + { + writer.WritePropertyName("execution_hint"); + JsonSerializer.Serialize(writer, ExecutionHintValue, options); + } + + if (FieldValue is not null) + { + writer.WritePropertyName("field"); + JsonSerializer.Serialize(writer, FieldValue, options); + } + + if (MaxDocsPerValueValue.HasValue) + { + writer.WritePropertyName("max_docs_per_value"); + writer.WriteNumberValue(MaxDocsPerValueValue.Value); + } + + if (ScriptValue is not null) + { + writer.WritePropertyName("script"); + JsonSerializer.Serialize(writer, ScriptValue, options); + } + + if (ShardSizeValue.HasValue) + { + writer.WritePropertyName("shard_size"); + writer.WriteNumberValue(ShardSizeValue.Value); + } + + writer.WriteEndObject(); + if (MetaValue is not null) + { + writer.WritePropertyName("meta"); + JsonSerializer.Serialize(writer, MetaValue, options); + } + + if (AggregationsDescriptor is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, AggregationsDescriptor, options); + } + else if (AggregationsDescriptorAction is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, new AggregationDescriptor(AggregationsDescriptorAction), options); + } + else if (AggregationsValue is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, AggregationsValue, options); + } + + writer.WriteEndObject(); + } +} + +public sealed partial class DiversifiedSamplerAggregationDescriptor : SerializableDescriptor +{ + internal DiversifiedSamplerAggregationDescriptor(Action configure) => configure.Invoke(this); + + public DiversifiedSamplerAggregationDescriptor() : base() + { + } + + private Elastic.Clients.Elasticsearch.Aggregations.AggregationDictionary? AggregationsValue { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor AggregationsDescriptor { get; set; } + private Action AggregationsDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregationExecutionHint? ExecutionHintValue { get; set; } + private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } + private int? MaxDocsPerValueValue { get; set; } + private IDictionary? MetaValue { get; set; } + private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } + private int? ShardSizeValue { get; set; } + + public DiversifiedSamplerAggregationDescriptor Aggregations(Elastic.Clients.Elasticsearch.Aggregations.AggregationDictionary? aggregations) + { + AggregationsDescriptor = null; + AggregationsDescriptorAction = null; + AggregationsValue = aggregations; + return Self; + } + + public DiversifiedSamplerAggregationDescriptor Aggregations(Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor descriptor) + { + AggregationsValue = null; + AggregationsDescriptorAction = null; + AggregationsDescriptor = descriptor; + return Self; + } + + public DiversifiedSamplerAggregationDescriptor Aggregations(Action configure) + { + AggregationsValue = null; + AggregationsDescriptor = null; + AggregationsDescriptorAction = configure; + return Self; + } + + public DiversifiedSamplerAggregationDescriptor ExecutionHint(Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregationExecutionHint? executionHint) + { + ExecutionHintValue = executionHint; + return Self; + } + + public DiversifiedSamplerAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + { + FieldValue = field; + return Self; + } + + public DiversifiedSamplerAggregationDescriptor Field(Expression> field) + { + FieldValue = field; + return Self; + } + + public DiversifiedSamplerAggregationDescriptor Field(Expression> field) + { + FieldValue = field; + return Self; + } + + public DiversifiedSamplerAggregationDescriptor MaxDocsPerValue(int? maxDocsPerValue) + { + MaxDocsPerValueValue = maxDocsPerValue; + return Self; + } + + public DiversifiedSamplerAggregationDescriptor Meta(Func, FluentDictionary> selector) + { + MetaValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + public DiversifiedSamplerAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + { + ScriptValue = script; + return Self; + } + + public DiversifiedSamplerAggregationDescriptor ShardSize(int? shardSize) + { + ShardSizeValue = shardSize; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("diversified_sampler"); + writer.WriteStartObject(); + if (ExecutionHintValue is not null) + { + writer.WritePropertyName("execution_hint"); + JsonSerializer.Serialize(writer, ExecutionHintValue, options); + } + + if (FieldValue is not null) + { + writer.WritePropertyName("field"); + JsonSerializer.Serialize(writer, FieldValue, options); + } + + if (MaxDocsPerValueValue.HasValue) + { + writer.WritePropertyName("max_docs_per_value"); + writer.WriteNumberValue(MaxDocsPerValueValue.Value); + } + + if (ScriptValue is not null) + { + writer.WritePropertyName("script"); + JsonSerializer.Serialize(writer, ScriptValue, options); + } + + if (ShardSizeValue.HasValue) + { + writer.WritePropertyName("shard_size"); + writer.WriteNumberValue(ShardSizeValue.Value); + } + + writer.WriteEndObject(); + if (MetaValue is not null) + { + writer.WritePropertyName("meta"); + JsonSerializer.Serialize(writer, MetaValue, options); + } + + if (AggregationsDescriptor is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, AggregationsDescriptor, options); + } + else if (AggregationsDescriptorAction is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, new AggregationDescriptor(AggregationsDescriptorAction), options); + } + else if (AggregationsValue is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, AggregationsValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoDistanceAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoDistanceAggregate.g.cs new file mode 100644 index 00000000000..e4ffb22ff65 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoDistanceAggregate.g.cs @@ -0,0 +1,39 @@ +// 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; + +/// +/// Result of a `geo_distance` aggregation. The unit for `from` and `to` is meters by default. +/// +public sealed partial class GeoDistanceAggregate : IAggregate +{ + [JsonInclude, JsonPropertyName("buckets")] + public IReadOnlyCollection Buckets { get; init; } + [JsonInclude, JsonPropertyName("meta")] + public IReadOnlyDictionary? Meta { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoDistanceAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoDistanceAggregation.g.cs new file mode 100644 index 00000000000..8d09308c1e0 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoDistanceAggregation.g.cs @@ -0,0 +1,621 @@ +// 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; + +internal sealed class GeoDistanceAggregationConverter : JsonConverter +{ + public override GeoDistanceAggregation Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + throw new JsonException("Unexpected JSON detected."); + reader.Read(); + var aggName = reader.GetString(); + if (aggName != "geo_distance") + throw new JsonException("Unexpected JSON detected."); + var agg = new GeoDistanceAggregation(aggName); + while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + { + if (reader.TokenType == JsonTokenType.PropertyName) + { + if (reader.ValueTextEquals("distance_type")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.DistanceType = value; + } + + continue; + } + + if (reader.ValueTextEquals("field")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.Field = value; + } + + continue; + } + + if (reader.ValueTextEquals("origin")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.Origin = value; + } + + continue; + } + + if (reader.ValueTextEquals("ranges")) + { + reader.Read(); + var value = JsonSerializer.Deserialize?>(ref reader, options); + if (value is not null) + { + agg.Ranges = value; + } + + continue; + } + + if (reader.ValueTextEquals("unit")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.Unit = value; + } + + continue; + } + } + } + + while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + { + if (reader.TokenType == JsonTokenType.PropertyName) + { + if (reader.ValueTextEquals("meta")) + { + var value = JsonSerializer.Deserialize>(ref reader, options); + if (value is not null) + { + agg.Meta = value; + } + + continue; + } + + if (reader.ValueTextEquals("aggs") || reader.ValueTextEquals("aggregations")) + { + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.Aggregations = value; + } + + continue; + } + } + } + + return agg; + } + + public override void Write(Utf8JsonWriter writer, GeoDistanceAggregation value, JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WritePropertyName("geo_distance"); + writer.WriteStartObject(); + if (value.DistanceType is not null) + { + writer.WritePropertyName("distance_type"); + JsonSerializer.Serialize(writer, value.DistanceType, options); + } + + if (value.Field is not null) + { + writer.WritePropertyName("field"); + JsonSerializer.Serialize(writer, value.Field, options); + } + + if (value.Origin is not null) + { + writer.WritePropertyName("origin"); + JsonSerializer.Serialize(writer, value.Origin, options); + } + + if (value.Ranges is not null) + { + writer.WritePropertyName("ranges"); + JsonSerializer.Serialize(writer, value.Ranges, options); + } + + if (value.Unit is not null) + { + writer.WritePropertyName("unit"); + JsonSerializer.Serialize(writer, value.Unit, options); + } + + writer.WriteEndObject(); + if (value.Meta is not null) + { + writer.WritePropertyName("meta"); + JsonSerializer.Serialize(writer, value.Meta, options); + } + + if (value.Aggregations is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, value.Aggregations, options); + } + + writer.WriteEndObject(); + } +} + +[JsonConverter(typeof(GeoDistanceAggregationConverter))] +public sealed partial class GeoDistanceAggregation : SearchAggregation +{ + public GeoDistanceAggregation(string name) => Name = name; + + internal GeoDistanceAggregation() + { + } + + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDictionary? Aggregations { get; set; } + public Elastic.Clients.Elasticsearch.GeoDistanceType? DistanceType { get; set; } + public Elastic.Clients.Elasticsearch.Field? Field { get; set; } + public IDictionary? Meta { get; set; } + override public string? Name { get; internal set; } + public Elastic.Clients.Elasticsearch.GeoLocation? Origin { get; set; } + public ICollection? Ranges { get; set; } + public Elastic.Clients.Elasticsearch.DistanceUnit? Unit { get; set; } +} + +public sealed partial class GeoDistanceAggregationDescriptor : SerializableDescriptor> +{ + internal GeoDistanceAggregationDescriptor(Action> configure) => configure.Invoke(this); + + public GeoDistanceAggregationDescriptor() : base() + { + } + + private Elastic.Clients.Elasticsearch.Aggregations.AggregationDictionary? AggregationsValue { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor AggregationsDescriptor { get; set; } + private Action> AggregationsDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.GeoDistanceType? DistanceTypeValue { get; set; } + private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } + private IDictionary? MetaValue { get; set; } + private Elastic.Clients.Elasticsearch.GeoLocation? OriginValue { get; set; } + private ICollection? RangesValue { get; set; } + private AggregationRangeDescriptor RangesDescriptor { get; set; } + private Action RangesDescriptorAction { get; set; } + private Action[] RangesDescriptorActions { get; set; } + private Elastic.Clients.Elasticsearch.DistanceUnit? UnitValue { get; set; } + + public GeoDistanceAggregationDescriptor Aggregations(Elastic.Clients.Elasticsearch.Aggregations.AggregationDictionary? aggregations) + { + AggregationsDescriptor = null; + AggregationsDescriptorAction = null; + AggregationsValue = aggregations; + return Self; + } + + public GeoDistanceAggregationDescriptor Aggregations(Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor descriptor) + { + AggregationsValue = null; + AggregationsDescriptorAction = null; + AggregationsDescriptor = descriptor; + return Self; + } + + public GeoDistanceAggregationDescriptor Aggregations(Action> configure) + { + AggregationsValue = null; + AggregationsDescriptor = null; + AggregationsDescriptorAction = configure; + return Self; + } + + public GeoDistanceAggregationDescriptor DistanceType(Elastic.Clients.Elasticsearch.GeoDistanceType? distanceType) + { + DistanceTypeValue = distanceType; + return Self; + } + + public GeoDistanceAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + { + FieldValue = field; + return Self; + } + + public GeoDistanceAggregationDescriptor Field(Expression> field) + { + FieldValue = field; + return Self; + } + + public GeoDistanceAggregationDescriptor Meta(Func, FluentDictionary> selector) + { + MetaValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + public GeoDistanceAggregationDescriptor Origin(Elastic.Clients.Elasticsearch.GeoLocation? origin) + { + OriginValue = origin; + return Self; + } + + public GeoDistanceAggregationDescriptor Ranges(ICollection? ranges) + { + RangesDescriptor = null; + RangesDescriptorAction = null; + RangesDescriptorActions = null; + RangesValue = ranges; + return Self; + } + + public GeoDistanceAggregationDescriptor Ranges(AggregationRangeDescriptor descriptor) + { + RangesValue = null; + RangesDescriptorAction = null; + RangesDescriptorActions = null; + RangesDescriptor = descriptor; + return Self; + } + + public GeoDistanceAggregationDescriptor Ranges(Action configure) + { + RangesValue = null; + RangesDescriptor = null; + RangesDescriptorActions = null; + RangesDescriptorAction = configure; + return Self; + } + + public GeoDistanceAggregationDescriptor Ranges(params Action[] configure) + { + RangesValue = null; + RangesDescriptor = null; + RangesDescriptorAction = null; + RangesDescriptorActions = configure; + return Self; + } + + public GeoDistanceAggregationDescriptor Unit(Elastic.Clients.Elasticsearch.DistanceUnit? unit) + { + UnitValue = unit; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("geo_distance"); + writer.WriteStartObject(); + if (DistanceTypeValue is not null) + { + writer.WritePropertyName("distance_type"); + JsonSerializer.Serialize(writer, DistanceTypeValue, options); + } + + if (FieldValue is not null) + { + writer.WritePropertyName("field"); + JsonSerializer.Serialize(writer, FieldValue, options); + } + + if (OriginValue is not null) + { + writer.WritePropertyName("origin"); + JsonSerializer.Serialize(writer, OriginValue, options); + } + + if (RangesDescriptor is not null) + { + writer.WritePropertyName("ranges"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, RangesDescriptor, options); + writer.WriteEndArray(); + } + else if (RangesDescriptorAction is not null) + { + writer.WritePropertyName("ranges"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, new AggregationRangeDescriptor(RangesDescriptorAction), options); + writer.WriteEndArray(); + } + else if (RangesDescriptorActions is not null) + { + writer.WritePropertyName("ranges"); + writer.WriteStartArray(); + foreach (var action in RangesDescriptorActions) + { + JsonSerializer.Serialize(writer, new AggregationRangeDescriptor(action), options); + } + + writer.WriteEndArray(); + } + else if (RangesValue is not null) + { + writer.WritePropertyName("ranges"); + JsonSerializer.Serialize(writer, RangesValue, options); + } + + if (UnitValue is not null) + { + writer.WritePropertyName("unit"); + JsonSerializer.Serialize(writer, UnitValue, options); + } + + writer.WriteEndObject(); + if (MetaValue is not null) + { + writer.WritePropertyName("meta"); + JsonSerializer.Serialize(writer, MetaValue, options); + } + + if (AggregationsDescriptor is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, AggregationsDescriptor, options); + } + else if (AggregationsDescriptorAction is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, new AggregationDescriptor(AggregationsDescriptorAction), options); + } + else if (AggregationsValue is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, AggregationsValue, options); + } + + writer.WriteEndObject(); + } +} + +public sealed partial class GeoDistanceAggregationDescriptor : SerializableDescriptor +{ + internal GeoDistanceAggregationDescriptor(Action configure) => configure.Invoke(this); + + public GeoDistanceAggregationDescriptor() : base() + { + } + + private Elastic.Clients.Elasticsearch.Aggregations.AggregationDictionary? AggregationsValue { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor AggregationsDescriptor { get; set; } + private Action AggregationsDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.GeoDistanceType? DistanceTypeValue { get; set; } + private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } + private IDictionary? MetaValue { get; set; } + private Elastic.Clients.Elasticsearch.GeoLocation? OriginValue { get; set; } + private ICollection? RangesValue { get; set; } + private AggregationRangeDescriptor RangesDescriptor { get; set; } + private Action RangesDescriptorAction { get; set; } + private Action[] RangesDescriptorActions { get; set; } + private Elastic.Clients.Elasticsearch.DistanceUnit? UnitValue { get; set; } + + public GeoDistanceAggregationDescriptor Aggregations(Elastic.Clients.Elasticsearch.Aggregations.AggregationDictionary? aggregations) + { + AggregationsDescriptor = null; + AggregationsDescriptorAction = null; + AggregationsValue = aggregations; + return Self; + } + + public GeoDistanceAggregationDescriptor Aggregations(Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor descriptor) + { + AggregationsValue = null; + AggregationsDescriptorAction = null; + AggregationsDescriptor = descriptor; + return Self; + } + + public GeoDistanceAggregationDescriptor Aggregations(Action configure) + { + AggregationsValue = null; + AggregationsDescriptor = null; + AggregationsDescriptorAction = configure; + return Self; + } + + public GeoDistanceAggregationDescriptor DistanceType(Elastic.Clients.Elasticsearch.GeoDistanceType? distanceType) + { + DistanceTypeValue = distanceType; + return Self; + } + + public GeoDistanceAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + { + FieldValue = field; + return Self; + } + + public GeoDistanceAggregationDescriptor Field(Expression> field) + { + FieldValue = field; + return Self; + } + + public GeoDistanceAggregationDescriptor Field(Expression> field) + { + FieldValue = field; + return Self; + } + + public GeoDistanceAggregationDescriptor Meta(Func, FluentDictionary> selector) + { + MetaValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + public GeoDistanceAggregationDescriptor Origin(Elastic.Clients.Elasticsearch.GeoLocation? origin) + { + OriginValue = origin; + return Self; + } + + public GeoDistanceAggregationDescriptor Ranges(ICollection? ranges) + { + RangesDescriptor = null; + RangesDescriptorAction = null; + RangesDescriptorActions = null; + RangesValue = ranges; + return Self; + } + + public GeoDistanceAggregationDescriptor Ranges(AggregationRangeDescriptor descriptor) + { + RangesValue = null; + RangesDescriptorAction = null; + RangesDescriptorActions = null; + RangesDescriptor = descriptor; + return Self; + } + + public GeoDistanceAggregationDescriptor Ranges(Action configure) + { + RangesValue = null; + RangesDescriptor = null; + RangesDescriptorActions = null; + RangesDescriptorAction = configure; + return Self; + } + + public GeoDistanceAggregationDescriptor Ranges(params Action[] configure) + { + RangesValue = null; + RangesDescriptor = null; + RangesDescriptorAction = null; + RangesDescriptorActions = configure; + return Self; + } + + public GeoDistanceAggregationDescriptor Unit(Elastic.Clients.Elasticsearch.DistanceUnit? unit) + { + UnitValue = unit; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("geo_distance"); + writer.WriteStartObject(); + if (DistanceTypeValue is not null) + { + writer.WritePropertyName("distance_type"); + JsonSerializer.Serialize(writer, DistanceTypeValue, options); + } + + if (FieldValue is not null) + { + writer.WritePropertyName("field"); + JsonSerializer.Serialize(writer, FieldValue, options); + } + + if (OriginValue is not null) + { + writer.WritePropertyName("origin"); + JsonSerializer.Serialize(writer, OriginValue, options); + } + + if (RangesDescriptor is not null) + { + writer.WritePropertyName("ranges"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, RangesDescriptor, options); + writer.WriteEndArray(); + } + else if (RangesDescriptorAction is not null) + { + writer.WritePropertyName("ranges"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, new AggregationRangeDescriptor(RangesDescriptorAction), options); + writer.WriteEndArray(); + } + else if (RangesDescriptorActions is not null) + { + writer.WritePropertyName("ranges"); + writer.WriteStartArray(); + foreach (var action in RangesDescriptorActions) + { + JsonSerializer.Serialize(writer, new AggregationRangeDescriptor(action), options); + } + + writer.WriteEndArray(); + } + else if (RangesValue is not null) + { + writer.WritePropertyName("ranges"); + JsonSerializer.Serialize(writer, RangesValue, options); + } + + if (UnitValue is not null) + { + writer.WritePropertyName("unit"); + JsonSerializer.Serialize(writer, UnitValue, options); + } + + writer.WriteEndObject(); + if (MetaValue is not null) + { + writer.WritePropertyName("meta"); + JsonSerializer.Serialize(writer, MetaValue, options); + } + + if (AggregationsDescriptor is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, AggregationsDescriptor, options); + } + else if (AggregationsDescriptorAction is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, new AggregationDescriptor(AggregationsDescriptorAction), options); + } + else if (AggregationsValue is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, AggregationsValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeohashGridAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeohashGridAggregate.g.cs new file mode 100644 index 00000000000..5b7c3c64f79 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeohashGridAggregate.g.cs @@ -0,0 +1,36 @@ +// 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 GeohashGridAggregate : IAggregate +{ + [JsonInclude, JsonPropertyName("buckets")] + public IReadOnlyCollection Buckets { get; init; } + [JsonInclude, JsonPropertyName("meta")] + public IReadOnlyDictionary? Meta { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeohashGridAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeohashGridAggregation.g.cs new file mode 100644 index 00000000000..6696c28859a --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeohashGridAggregation.g.cs @@ -0,0 +1,505 @@ +// 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; + +internal sealed class GeohashGridAggregationConverter : JsonConverter +{ + public override GeohashGridAggregation Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + throw new JsonException("Unexpected JSON detected."); + reader.Read(); + var aggName = reader.GetString(); + if (aggName != "geohash_grid") + throw new JsonException("Unexpected JSON detected."); + var agg = new GeohashGridAggregation(aggName); + while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + { + if (reader.TokenType == JsonTokenType.PropertyName) + { + if (reader.ValueTextEquals("bounds")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.Bounds = value; + } + + continue; + } + + if (reader.ValueTextEquals("field")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.Field = value; + } + + continue; + } + + if (reader.ValueTextEquals("precision")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.Precision = value; + } + + continue; + } + + if (reader.ValueTextEquals("shard_size")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.ShardSize = value; + } + + continue; + } + + if (reader.ValueTextEquals("size")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.Size = value; + } + + continue; + } + } + } + + while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + { + if (reader.TokenType == JsonTokenType.PropertyName) + { + if (reader.ValueTextEquals("meta")) + { + var value = JsonSerializer.Deserialize>(ref reader, options); + if (value is not null) + { + agg.Meta = value; + } + + continue; + } + + if (reader.ValueTextEquals("aggs") || reader.ValueTextEquals("aggregations")) + { + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.Aggregations = value; + } + + continue; + } + } + } + + return agg; + } + + public override void Write(Utf8JsonWriter writer, GeohashGridAggregation value, JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WritePropertyName("geohash_grid"); + writer.WriteStartObject(); + if (value.Bounds is not null) + { + writer.WritePropertyName("bounds"); + JsonSerializer.Serialize(writer, value.Bounds, options); + } + + if (value.Field is not null) + { + writer.WritePropertyName("field"); + JsonSerializer.Serialize(writer, value.Field, options); + } + + if (value.Precision is not null) + { + writer.WritePropertyName("precision"); + JsonSerializer.Serialize(writer, value.Precision, options); + } + + if (value.ShardSize.HasValue) + { + writer.WritePropertyName("shard_size"); + writer.WriteNumberValue(value.ShardSize.Value); + } + + if (value.Size.HasValue) + { + writer.WritePropertyName("size"); + writer.WriteNumberValue(value.Size.Value); + } + + writer.WriteEndObject(); + if (value.Meta is not null) + { + writer.WritePropertyName("meta"); + JsonSerializer.Serialize(writer, value.Meta, options); + } + + if (value.Aggregations is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, value.Aggregations, options); + } + + writer.WriteEndObject(); + } +} + +[JsonConverter(typeof(GeohashGridAggregationConverter))] +public sealed partial class GeohashGridAggregation : SearchAggregation +{ + public GeohashGridAggregation(string name) => Name = name; + + internal GeohashGridAggregation() + { + } + + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDictionary? Aggregations { get; set; } + public Elastic.Clients.Elasticsearch.GeoBounds? Bounds { get; set; } + public Elastic.Clients.Elasticsearch.Field? Field { get; set; } + public IDictionary? Meta { get; set; } + override public string? Name { get; internal set; } + public Elastic.Clients.Elasticsearch.GeohashPrecision? Precision { get; set; } + public int? ShardSize { get; set; } + public int? Size { get; set; } +} + +public sealed partial class GeohashGridAggregationDescriptor : SerializableDescriptor> +{ + internal GeohashGridAggregationDescriptor(Action> configure) => configure.Invoke(this); + + public GeohashGridAggregationDescriptor() : base() + { + } + + private Elastic.Clients.Elasticsearch.Aggregations.AggregationDictionary? AggregationsValue { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor AggregationsDescriptor { get; set; } + private Action> AggregationsDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.GeoBounds? BoundsValue { get; set; } + private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } + private IDictionary? MetaValue { get; set; } + private Elastic.Clients.Elasticsearch.GeohashPrecision? PrecisionValue { get; set; } + private int? ShardSizeValue { get; set; } + private int? SizeValue { get; set; } + + public GeohashGridAggregationDescriptor Aggregations(Elastic.Clients.Elasticsearch.Aggregations.AggregationDictionary? aggregations) + { + AggregationsDescriptor = null; + AggregationsDescriptorAction = null; + AggregationsValue = aggregations; + return Self; + } + + public GeohashGridAggregationDescriptor Aggregations(Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor descriptor) + { + AggregationsValue = null; + AggregationsDescriptorAction = null; + AggregationsDescriptor = descriptor; + return Self; + } + + public GeohashGridAggregationDescriptor Aggregations(Action> configure) + { + AggregationsValue = null; + AggregationsDescriptor = null; + AggregationsDescriptorAction = configure; + return Self; + } + + public GeohashGridAggregationDescriptor Bounds(Elastic.Clients.Elasticsearch.GeoBounds? bounds) + { + BoundsValue = bounds; + return Self; + } + + public GeohashGridAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + { + FieldValue = field; + return Self; + } + + public GeohashGridAggregationDescriptor Field(Expression> field) + { + FieldValue = field; + return Self; + } + + public GeohashGridAggregationDescriptor Meta(Func, FluentDictionary> selector) + { + MetaValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + public GeohashGridAggregationDescriptor Precision(Elastic.Clients.Elasticsearch.GeohashPrecision? precision) + { + PrecisionValue = precision; + return Self; + } + + public GeohashGridAggregationDescriptor ShardSize(int? shardSize) + { + ShardSizeValue = shardSize; + return Self; + } + + public GeohashGridAggregationDescriptor Size(int? size) + { + SizeValue = size; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("geohash_grid"); + writer.WriteStartObject(); + if (BoundsValue is not null) + { + writer.WritePropertyName("bounds"); + JsonSerializer.Serialize(writer, BoundsValue, options); + } + + if (FieldValue is not null) + { + writer.WritePropertyName("field"); + JsonSerializer.Serialize(writer, FieldValue, options); + } + + if (PrecisionValue is not null) + { + writer.WritePropertyName("precision"); + JsonSerializer.Serialize(writer, PrecisionValue, options); + } + + if (ShardSizeValue.HasValue) + { + writer.WritePropertyName("shard_size"); + writer.WriteNumberValue(ShardSizeValue.Value); + } + + if (SizeValue.HasValue) + { + writer.WritePropertyName("size"); + writer.WriteNumberValue(SizeValue.Value); + } + + writer.WriteEndObject(); + if (MetaValue is not null) + { + writer.WritePropertyName("meta"); + JsonSerializer.Serialize(writer, MetaValue, options); + } + + if (AggregationsDescriptor is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, AggregationsDescriptor, options); + } + else if (AggregationsDescriptorAction is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, new AggregationDescriptor(AggregationsDescriptorAction), options); + } + else if (AggregationsValue is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, AggregationsValue, options); + } + + writer.WriteEndObject(); + } +} + +public sealed partial class GeohashGridAggregationDescriptor : SerializableDescriptor +{ + internal GeohashGridAggregationDescriptor(Action configure) => configure.Invoke(this); + + public GeohashGridAggregationDescriptor() : base() + { + } + + private Elastic.Clients.Elasticsearch.Aggregations.AggregationDictionary? AggregationsValue { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor AggregationsDescriptor { get; set; } + private Action AggregationsDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.GeoBounds? BoundsValue { get; set; } + private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } + private IDictionary? MetaValue { get; set; } + private Elastic.Clients.Elasticsearch.GeohashPrecision? PrecisionValue { get; set; } + private int? ShardSizeValue { get; set; } + private int? SizeValue { get; set; } + + public GeohashGridAggregationDescriptor Aggregations(Elastic.Clients.Elasticsearch.Aggregations.AggregationDictionary? aggregations) + { + AggregationsDescriptor = null; + AggregationsDescriptorAction = null; + AggregationsValue = aggregations; + return Self; + } + + public GeohashGridAggregationDescriptor Aggregations(Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor descriptor) + { + AggregationsValue = null; + AggregationsDescriptorAction = null; + AggregationsDescriptor = descriptor; + return Self; + } + + public GeohashGridAggregationDescriptor Aggregations(Action configure) + { + AggregationsValue = null; + AggregationsDescriptor = null; + AggregationsDescriptorAction = configure; + return Self; + } + + public GeohashGridAggregationDescriptor Bounds(Elastic.Clients.Elasticsearch.GeoBounds? bounds) + { + BoundsValue = bounds; + return Self; + } + + public GeohashGridAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + { + FieldValue = field; + return Self; + } + + public GeohashGridAggregationDescriptor Field(Expression> field) + { + FieldValue = field; + return Self; + } + + public GeohashGridAggregationDescriptor Field(Expression> field) + { + FieldValue = field; + return Self; + } + + public GeohashGridAggregationDescriptor Meta(Func, FluentDictionary> selector) + { + MetaValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + public GeohashGridAggregationDescriptor Precision(Elastic.Clients.Elasticsearch.GeohashPrecision? precision) + { + PrecisionValue = precision; + return Self; + } + + public GeohashGridAggregationDescriptor ShardSize(int? shardSize) + { + ShardSizeValue = shardSize; + return Self; + } + + public GeohashGridAggregationDescriptor Size(int? size) + { + SizeValue = size; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("geohash_grid"); + writer.WriteStartObject(); + if (BoundsValue is not null) + { + writer.WritePropertyName("bounds"); + JsonSerializer.Serialize(writer, BoundsValue, options); + } + + if (FieldValue is not null) + { + writer.WritePropertyName("field"); + JsonSerializer.Serialize(writer, FieldValue, options); + } + + if (PrecisionValue is not null) + { + writer.WritePropertyName("precision"); + JsonSerializer.Serialize(writer, PrecisionValue, options); + } + + if (ShardSizeValue.HasValue) + { + writer.WritePropertyName("shard_size"); + writer.WriteNumberValue(ShardSizeValue.Value); + } + + if (SizeValue.HasValue) + { + writer.WritePropertyName("size"); + writer.WriteNumberValue(SizeValue.Value); + } + + writer.WriteEndObject(); + if (MetaValue is not null) + { + writer.WritePropertyName("meta"); + JsonSerializer.Serialize(writer, MetaValue, options); + } + + if (AggregationsDescriptor is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, AggregationsDescriptor, options); + } + else if (AggregationsDescriptorAction is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, new AggregationDescriptor(AggregationsDescriptorAction), options); + } + else if (AggregationsValue is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, AggregationsValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeohashGridBucket.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeohashGridBucket.g.cs new file mode 100644 index 00000000000..72757387c3a --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeohashGridBucket.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. +// +// ------------------------------------------------ + +#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; + +[JsonConverter(typeof(GeohashGridBucketConverter))] +public sealed partial class GeohashGridBucket : AggregateDictionary +{ + public GeohashGridBucket(IReadOnlyDictionary backingDictionary) : base(backingDictionary) + { + } + + [JsonInclude, JsonPropertyName("doc_count")] + public long DocCount { get; init; } + [JsonInclude, JsonPropertyName("key")] + public string Key { get; init; } +} + +internal sealed class GeohashGridBucketConverter : JsonConverter +{ + public override GeohashGridBucket? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + throw new JsonException($"Expected {JsonTokenType.StartObject} but read {reader.TokenType}."); + var subAggs = new Dictionary();// TODO - Optimise this and only create if we need it. + long docCount = default; + string key = default; + while (reader.Read()) + { + if (reader.TokenType == JsonTokenType.EndObject) + break; + if (reader.TokenType != JsonTokenType.PropertyName) + throw new JsonException($"Expected {JsonTokenType.PropertyName} but read {reader.TokenType}."); + var name = reader.GetString();// TODO: Future optimisation, get raw bytes span and parse based on those + reader.Read(); + if (name.Equals("doc_count", StringComparison.Ordinal)) + { + docCount = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (name.Equals("key", StringComparison.Ordinal)) + { + key = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (name.Contains("#")) + { + AggregateDictionaryConverter.ReadAggregate(ref reader, options, subAggs, name); + continue; + } + + throw new JsonException("Unknown property read from JSON."); + } + + return new GeohashGridBucket(subAggs) { DocCount = docCount, Key = key }; + } + + public override void Write(Utf8JsonWriter writer, GeohashGridBucket value, JsonSerializerOptions options) => throw new NotImplementedException(); +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeohexGridAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeohexGridAggregate.g.cs new file mode 100644 index 00000000000..b70f968b98f --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeohexGridAggregate.g.cs @@ -0,0 +1,36 @@ +// 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 GeohexGridAggregate : IAggregate +{ + [JsonInclude, JsonPropertyName("buckets")] + public IReadOnlyCollection Buckets { get; init; } + [JsonInclude, JsonPropertyName("meta")] + public IReadOnlyDictionary? Meta { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeohexGridAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeohexGridAggregation.g.cs new file mode 100644 index 00000000000..fc8c12b855a --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeohexGridAggregation.g.cs @@ -0,0 +1,548 @@ +// 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; + +internal sealed class GeohexGridAggregationConverter : JsonConverter +{ + public override GeohexGridAggregation Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + throw new JsonException("Unexpected JSON detected."); + reader.Read(); + var aggName = reader.GetString(); + if (aggName != "geohex_grid") + throw new JsonException("Unexpected JSON detected."); + var agg = new GeohexGridAggregation(aggName); + while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + { + if (reader.TokenType == JsonTokenType.PropertyName) + { + if (reader.ValueTextEquals("bounds")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.Bounds = value; + } + + continue; + } + + if (reader.ValueTextEquals("field")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + agg.Field = value; + continue; + } + + if (reader.ValueTextEquals("precision")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.Precision = value; + } + + continue; + } + + if (reader.ValueTextEquals("shard_size")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.ShardSize = value; + } + + continue; + } + + if (reader.ValueTextEquals("size")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.Size = value; + } + + continue; + } + } + } + + while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + { + if (reader.TokenType == JsonTokenType.PropertyName) + { + if (reader.ValueTextEquals("meta")) + { + var value = JsonSerializer.Deserialize>(ref reader, options); + if (value is not null) + { + agg.Meta = value; + } + + continue; + } + + if (reader.ValueTextEquals("aggs") || reader.ValueTextEquals("aggregations")) + { + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.Aggregations = value; + } + + continue; + } + } + } + + return agg; + } + + public override void Write(Utf8JsonWriter writer, GeohexGridAggregation value, JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WritePropertyName("geohex_grid"); + writer.WriteStartObject(); + if (value.Bounds is not null) + { + writer.WritePropertyName("bounds"); + JsonSerializer.Serialize(writer, value.Bounds, options); + } + + writer.WritePropertyName("field"); + JsonSerializer.Serialize(writer, value.Field, options); + if (value.Precision.HasValue) + { + writer.WritePropertyName("precision"); + writer.WriteNumberValue(value.Precision.Value); + } + + if (value.ShardSize.HasValue) + { + writer.WritePropertyName("shard_size"); + writer.WriteNumberValue(value.ShardSize.Value); + } + + if (value.Size.HasValue) + { + writer.WritePropertyName("size"); + writer.WriteNumberValue(value.Size.Value); + } + + writer.WriteEndObject(); + if (value.Meta is not null) + { + writer.WritePropertyName("meta"); + JsonSerializer.Serialize(writer, value.Meta, options); + } + + if (value.Aggregations is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, value.Aggregations, options); + } + + writer.WriteEndObject(); + } +} + +[JsonConverter(typeof(GeohexGridAggregationConverter))] +public sealed partial class GeohexGridAggregation : SearchAggregation +{ + public GeohexGridAggregation(string name) => Name = name; + + internal GeohexGridAggregation() + { + } + + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDictionary? Aggregations { get; set; } + + /// + /// Bounding box used to filter the geo-points in each bucket. + /// + public Elastic.Clients.Elasticsearch.GeoBounds? Bounds { get; set; } + + /// + /// Field containing indexed geo-point values. Must be explicitly
mapped as a `geo_point` field. If the field contains an array
`geohex_grid` aggregates all array values.
+ ///
+ public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public IDictionary? Meta { get; set; } + override public string? Name { get; internal set; } + + /// + /// Integer zoom of the key used to defined cells or buckets
in the results. Value should be between 0-15.
+ ///
+ public int? Precision { get; set; } + + /// + /// Number of buckets returned from each shard. + /// + public int? ShardSize { get; set; } + + /// + /// Maximum number of buckets to return. + /// + public int? Size { get; set; } +} + +public sealed partial class GeohexGridAggregationDescriptor : SerializableDescriptor> +{ + internal GeohexGridAggregationDescriptor(Action> configure) => configure.Invoke(this); + + public GeohexGridAggregationDescriptor() : base() + { + } + + private Elastic.Clients.Elasticsearch.Aggregations.AggregationDictionary? AggregationsValue { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor AggregationsDescriptor { get; set; } + private Action> AggregationsDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.GeoBounds? BoundsValue { get; set; } + private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } + private IDictionary? MetaValue { get; set; } + private int? PrecisionValue { get; set; } + private int? ShardSizeValue { get; set; } + private int? SizeValue { get; set; } + + public GeohexGridAggregationDescriptor Aggregations(Elastic.Clients.Elasticsearch.Aggregations.AggregationDictionary? aggregations) + { + AggregationsDescriptor = null; + AggregationsDescriptorAction = null; + AggregationsValue = aggregations; + return Self; + } + + public GeohexGridAggregationDescriptor Aggregations(Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor descriptor) + { + AggregationsValue = null; + AggregationsDescriptorAction = null; + AggregationsDescriptor = descriptor; + return Self; + } + + public GeohexGridAggregationDescriptor Aggregations(Action> configure) + { + AggregationsValue = null; + AggregationsDescriptor = null; + AggregationsDescriptorAction = configure; + return Self; + } + + /// + /// Bounding box used to filter the geo-points in each bucket. + /// + public GeohexGridAggregationDescriptor Bounds(Elastic.Clients.Elasticsearch.GeoBounds? bounds) + { + BoundsValue = bounds; + return Self; + } + + /// + /// Field containing indexed geo-point values. Must be explicitly
mapped as a `geo_point` field. If the field contains an array
`geohex_grid` aggregates all array values.
+ ///
+ public GeohexGridAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + { + FieldValue = field; + return Self; + } + + /// + /// Field containing indexed geo-point values. Must be explicitly
mapped as a `geo_point` field. If the field contains an array
`geohex_grid` aggregates all array values.
+ ///
+ public GeohexGridAggregationDescriptor Field(Expression> field) + { + FieldValue = field; + return Self; + } + + public GeohexGridAggregationDescriptor Meta(Func, FluentDictionary> selector) + { + MetaValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + /// + /// Integer zoom of the key used to defined cells or buckets
in the results. Value should be between 0-15.
+ ///
+ public GeohexGridAggregationDescriptor Precision(int? precision) + { + PrecisionValue = precision; + return Self; + } + + /// + /// Number of buckets returned from each shard. + /// + public GeohexGridAggregationDescriptor ShardSize(int? shardSize) + { + ShardSizeValue = shardSize; + return Self; + } + + /// + /// Maximum number of buckets to return. + /// + public GeohexGridAggregationDescriptor Size(int? size) + { + SizeValue = size; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("geohex_grid"); + writer.WriteStartObject(); + if (BoundsValue is not null) + { + writer.WritePropertyName("bounds"); + JsonSerializer.Serialize(writer, BoundsValue, options); + } + + writer.WritePropertyName("field"); + JsonSerializer.Serialize(writer, FieldValue, options); + if (PrecisionValue.HasValue) + { + writer.WritePropertyName("precision"); + writer.WriteNumberValue(PrecisionValue.Value); + } + + if (ShardSizeValue.HasValue) + { + writer.WritePropertyName("shard_size"); + writer.WriteNumberValue(ShardSizeValue.Value); + } + + if (SizeValue.HasValue) + { + writer.WritePropertyName("size"); + writer.WriteNumberValue(SizeValue.Value); + } + + writer.WriteEndObject(); + if (MetaValue is not null) + { + writer.WritePropertyName("meta"); + JsonSerializer.Serialize(writer, MetaValue, options); + } + + if (AggregationsDescriptor is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, AggregationsDescriptor, options); + } + else if (AggregationsDescriptorAction is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, new AggregationDescriptor(AggregationsDescriptorAction), options); + } + else if (AggregationsValue is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, AggregationsValue, options); + } + + writer.WriteEndObject(); + } +} + +public sealed partial class GeohexGridAggregationDescriptor : SerializableDescriptor +{ + internal GeohexGridAggregationDescriptor(Action configure) => configure.Invoke(this); + + public GeohexGridAggregationDescriptor() : base() + { + } + + private Elastic.Clients.Elasticsearch.Aggregations.AggregationDictionary? AggregationsValue { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor AggregationsDescriptor { get; set; } + private Action AggregationsDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.GeoBounds? BoundsValue { get; set; } + private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } + private IDictionary? MetaValue { get; set; } + private int? PrecisionValue { get; set; } + private int? ShardSizeValue { get; set; } + private int? SizeValue { get; set; } + + public GeohexGridAggregationDescriptor Aggregations(Elastic.Clients.Elasticsearch.Aggregations.AggregationDictionary? aggregations) + { + AggregationsDescriptor = null; + AggregationsDescriptorAction = null; + AggregationsValue = aggregations; + return Self; + } + + public GeohexGridAggregationDescriptor Aggregations(Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor descriptor) + { + AggregationsValue = null; + AggregationsDescriptorAction = null; + AggregationsDescriptor = descriptor; + return Self; + } + + public GeohexGridAggregationDescriptor Aggregations(Action configure) + { + AggregationsValue = null; + AggregationsDescriptor = null; + AggregationsDescriptorAction = configure; + return Self; + } + + /// + /// Bounding box used to filter the geo-points in each bucket. + /// + public GeohexGridAggregationDescriptor Bounds(Elastic.Clients.Elasticsearch.GeoBounds? bounds) + { + BoundsValue = bounds; + return Self; + } + + /// + /// Field containing indexed geo-point values. Must be explicitly
mapped as a `geo_point` field. If the field contains an array
`geohex_grid` aggregates all array values.
+ ///
+ public GeohexGridAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + { + FieldValue = field; + return Self; + } + + /// + /// Field containing indexed geo-point values. Must be explicitly
mapped as a `geo_point` field. If the field contains an array
`geohex_grid` aggregates all array values.
+ ///
+ public GeohexGridAggregationDescriptor Field(Expression> field) + { + FieldValue = field; + return Self; + } + + /// + /// Field containing indexed geo-point values. Must be explicitly
mapped as a `geo_point` field. If the field contains an array
`geohex_grid` aggregates all array values.
+ ///
+ public GeohexGridAggregationDescriptor Field(Expression> field) + { + FieldValue = field; + return Self; + } + + public GeohexGridAggregationDescriptor Meta(Func, FluentDictionary> selector) + { + MetaValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + /// + /// Integer zoom of the key used to defined cells or buckets
in the results. Value should be between 0-15.
+ ///
+ public GeohexGridAggregationDescriptor Precision(int? precision) + { + PrecisionValue = precision; + return Self; + } + + /// + /// Number of buckets returned from each shard. + /// + public GeohexGridAggregationDescriptor ShardSize(int? shardSize) + { + ShardSizeValue = shardSize; + return Self; + } + + /// + /// Maximum number of buckets to return. + /// + public GeohexGridAggregationDescriptor Size(int? size) + { + SizeValue = size; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("geohex_grid"); + writer.WriteStartObject(); + if (BoundsValue is not null) + { + writer.WritePropertyName("bounds"); + JsonSerializer.Serialize(writer, BoundsValue, options); + } + + writer.WritePropertyName("field"); + JsonSerializer.Serialize(writer, FieldValue, options); + if (PrecisionValue.HasValue) + { + writer.WritePropertyName("precision"); + writer.WriteNumberValue(PrecisionValue.Value); + } + + if (ShardSizeValue.HasValue) + { + writer.WritePropertyName("shard_size"); + writer.WriteNumberValue(ShardSizeValue.Value); + } + + if (SizeValue.HasValue) + { + writer.WritePropertyName("size"); + writer.WriteNumberValue(SizeValue.Value); + } + + writer.WriteEndObject(); + if (MetaValue is not null) + { + writer.WritePropertyName("meta"); + JsonSerializer.Serialize(writer, MetaValue, options); + } + + if (AggregationsDescriptor is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, AggregationsDescriptor, options); + } + else if (AggregationsDescriptorAction is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, new AggregationDescriptor(AggregationsDescriptorAction), options); + } + else if (AggregationsValue is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, AggregationsValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeohexGridBucket.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeohexGridBucket.g.cs new file mode 100644 index 00000000000..15b1ed0f912 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeohexGridBucket.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. +// +// ------------------------------------------------ + +#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; + +[JsonConverter(typeof(GeohexGridBucketConverter))] +public sealed partial class GeohexGridBucket : AggregateDictionary +{ + public GeohexGridBucket(IReadOnlyDictionary backingDictionary) : base(backingDictionary) + { + } + + [JsonInclude, JsonPropertyName("doc_count")] + public long DocCount { get; init; } + [JsonInclude, JsonPropertyName("key")] + public string Key { get; init; } +} + +internal sealed class GeohexGridBucketConverter : JsonConverter +{ + public override GeohexGridBucket? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + throw new JsonException($"Expected {JsonTokenType.StartObject} but read {reader.TokenType}."); + var subAggs = new Dictionary();// TODO - Optimise this and only create if we need it. + long docCount = default; + string key = default; + while (reader.Read()) + { + if (reader.TokenType == JsonTokenType.EndObject) + break; + if (reader.TokenType != JsonTokenType.PropertyName) + throw new JsonException($"Expected {JsonTokenType.PropertyName} but read {reader.TokenType}."); + var name = reader.GetString();// TODO: Future optimisation, get raw bytes span and parse based on those + reader.Read(); + if (name.Equals("doc_count", StringComparison.Ordinal)) + { + docCount = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (name.Equals("key", StringComparison.Ordinal)) + { + key = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (name.Contains("#")) + { + AggregateDictionaryConverter.ReadAggregate(ref reader, options, subAggs, name); + continue; + } + + throw new JsonException("Unknown property read from JSON."); + } + + return new GeohexGridBucket(subAggs) { DocCount = docCount, Key = key }; + } + + public override void Write(Utf8JsonWriter writer, GeohexGridBucket value, JsonSerializerOptions options) => throw new NotImplementedException(); +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeotileGridAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeotileGridAggregate.g.cs new file mode 100644 index 00000000000..ff2bbda7bd4 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeotileGridAggregate.g.cs @@ -0,0 +1,36 @@ +// 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 GeotileGridAggregate : IAggregate +{ + [JsonInclude, JsonPropertyName("buckets")] + public IReadOnlyCollection Buckets { get; init; } + [JsonInclude, JsonPropertyName("meta")] + public IReadOnlyDictionary? Meta { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeotileGridAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeotileGridAggregation.g.cs new file mode 100644 index 00000000000..15ce214daa5 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeotileGridAggregation.g.cs @@ -0,0 +1,505 @@ +// 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; + +internal sealed class GeotileGridAggregationConverter : JsonConverter +{ + public override GeotileGridAggregation Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + throw new JsonException("Unexpected JSON detected."); + reader.Read(); + var aggName = reader.GetString(); + if (aggName != "geotile_grid") + throw new JsonException("Unexpected JSON detected."); + var agg = new GeotileGridAggregation(aggName); + while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + { + if (reader.TokenType == JsonTokenType.PropertyName) + { + if (reader.ValueTextEquals("bounds")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.Bounds = value; + } + + continue; + } + + if (reader.ValueTextEquals("field")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.Field = value; + } + + continue; + } + + if (reader.ValueTextEquals("precision")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.Precision = value; + } + + continue; + } + + if (reader.ValueTextEquals("shard_size")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.ShardSize = value; + } + + continue; + } + + if (reader.ValueTextEquals("size")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.Size = value; + } + + continue; + } + } + } + + while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + { + if (reader.TokenType == JsonTokenType.PropertyName) + { + if (reader.ValueTextEquals("meta")) + { + var value = JsonSerializer.Deserialize>(ref reader, options); + if (value is not null) + { + agg.Meta = value; + } + + continue; + } + + if (reader.ValueTextEquals("aggs") || reader.ValueTextEquals("aggregations")) + { + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.Aggregations = value; + } + + continue; + } + } + } + + return agg; + } + + public override void Write(Utf8JsonWriter writer, GeotileGridAggregation value, JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WritePropertyName("geotile_grid"); + writer.WriteStartObject(); + if (value.Bounds is not null) + { + writer.WritePropertyName("bounds"); + JsonSerializer.Serialize(writer, value.Bounds, options); + } + + if (value.Field is not null) + { + writer.WritePropertyName("field"); + JsonSerializer.Serialize(writer, value.Field, options); + } + + if (value.Precision is not null) + { + writer.WritePropertyName("precision"); + JsonSerializer.Serialize(writer, value.Precision, options); + } + + if (value.ShardSize.HasValue) + { + writer.WritePropertyName("shard_size"); + writer.WriteNumberValue(value.ShardSize.Value); + } + + if (value.Size.HasValue) + { + writer.WritePropertyName("size"); + writer.WriteNumberValue(value.Size.Value); + } + + writer.WriteEndObject(); + if (value.Meta is not null) + { + writer.WritePropertyName("meta"); + JsonSerializer.Serialize(writer, value.Meta, options); + } + + if (value.Aggregations is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, value.Aggregations, options); + } + + writer.WriteEndObject(); + } +} + +[JsonConverter(typeof(GeotileGridAggregationConverter))] +public sealed partial class GeotileGridAggregation : SearchAggregation +{ + public GeotileGridAggregation(string name) => Name = name; + + internal GeotileGridAggregation() + { + } + + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDictionary? Aggregations { get; set; } + public Elastic.Clients.Elasticsearch.GeoBounds? Bounds { get; set; } + public Elastic.Clients.Elasticsearch.Field? Field { get; set; } + public IDictionary? Meta { get; set; } + override public string? Name { get; internal set; } + public double? Precision { get; set; } + public int? ShardSize { get; set; } + public int? Size { get; set; } +} + +public sealed partial class GeotileGridAggregationDescriptor : SerializableDescriptor> +{ + internal GeotileGridAggregationDescriptor(Action> configure) => configure.Invoke(this); + + public GeotileGridAggregationDescriptor() : base() + { + } + + private Elastic.Clients.Elasticsearch.Aggregations.AggregationDictionary? AggregationsValue { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor AggregationsDescriptor { get; set; } + private Action> AggregationsDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.GeoBounds? BoundsValue { get; set; } + private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } + private IDictionary? MetaValue { get; set; } + private double? PrecisionValue { get; set; } + private int? ShardSizeValue { get; set; } + private int? SizeValue { get; set; } + + public GeotileGridAggregationDescriptor Aggregations(Elastic.Clients.Elasticsearch.Aggregations.AggregationDictionary? aggregations) + { + AggregationsDescriptor = null; + AggregationsDescriptorAction = null; + AggregationsValue = aggregations; + return Self; + } + + public GeotileGridAggregationDescriptor Aggregations(Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor descriptor) + { + AggregationsValue = null; + AggregationsDescriptorAction = null; + AggregationsDescriptor = descriptor; + return Self; + } + + public GeotileGridAggregationDescriptor Aggregations(Action> configure) + { + AggregationsValue = null; + AggregationsDescriptor = null; + AggregationsDescriptorAction = configure; + return Self; + } + + public GeotileGridAggregationDescriptor Bounds(Elastic.Clients.Elasticsearch.GeoBounds? bounds) + { + BoundsValue = bounds; + return Self; + } + + public GeotileGridAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + { + FieldValue = field; + return Self; + } + + public GeotileGridAggregationDescriptor Field(Expression> field) + { + FieldValue = field; + return Self; + } + + public GeotileGridAggregationDescriptor Meta(Func, FluentDictionary> selector) + { + MetaValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + public GeotileGridAggregationDescriptor Precision(double? precision) + { + PrecisionValue = precision; + return Self; + } + + public GeotileGridAggregationDescriptor ShardSize(int? shardSize) + { + ShardSizeValue = shardSize; + return Self; + } + + public GeotileGridAggregationDescriptor Size(int? size) + { + SizeValue = size; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("geotile_grid"); + writer.WriteStartObject(); + if (BoundsValue is not null) + { + writer.WritePropertyName("bounds"); + JsonSerializer.Serialize(writer, BoundsValue, options); + } + + if (FieldValue is not null) + { + writer.WritePropertyName("field"); + JsonSerializer.Serialize(writer, FieldValue, options); + } + + if (PrecisionValue is not null) + { + writer.WritePropertyName("precision"); + JsonSerializer.Serialize(writer, PrecisionValue, options); + } + + if (ShardSizeValue.HasValue) + { + writer.WritePropertyName("shard_size"); + writer.WriteNumberValue(ShardSizeValue.Value); + } + + if (SizeValue.HasValue) + { + writer.WritePropertyName("size"); + writer.WriteNumberValue(SizeValue.Value); + } + + writer.WriteEndObject(); + if (MetaValue is not null) + { + writer.WritePropertyName("meta"); + JsonSerializer.Serialize(writer, MetaValue, options); + } + + if (AggregationsDescriptor is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, AggregationsDescriptor, options); + } + else if (AggregationsDescriptorAction is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, new AggregationDescriptor(AggregationsDescriptorAction), options); + } + else if (AggregationsValue is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, AggregationsValue, options); + } + + writer.WriteEndObject(); + } +} + +public sealed partial class GeotileGridAggregationDescriptor : SerializableDescriptor +{ + internal GeotileGridAggregationDescriptor(Action configure) => configure.Invoke(this); + + public GeotileGridAggregationDescriptor() : base() + { + } + + private Elastic.Clients.Elasticsearch.Aggregations.AggregationDictionary? AggregationsValue { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor AggregationsDescriptor { get; set; } + private Action AggregationsDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.GeoBounds? BoundsValue { get; set; } + private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } + private IDictionary? MetaValue { get; set; } + private double? PrecisionValue { get; set; } + private int? ShardSizeValue { get; set; } + private int? SizeValue { get; set; } + + public GeotileGridAggregationDescriptor Aggregations(Elastic.Clients.Elasticsearch.Aggregations.AggregationDictionary? aggregations) + { + AggregationsDescriptor = null; + AggregationsDescriptorAction = null; + AggregationsValue = aggregations; + return Self; + } + + public GeotileGridAggregationDescriptor Aggregations(Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor descriptor) + { + AggregationsValue = null; + AggregationsDescriptorAction = null; + AggregationsDescriptor = descriptor; + return Self; + } + + public GeotileGridAggregationDescriptor Aggregations(Action configure) + { + AggregationsValue = null; + AggregationsDescriptor = null; + AggregationsDescriptorAction = configure; + return Self; + } + + public GeotileGridAggregationDescriptor Bounds(Elastic.Clients.Elasticsearch.GeoBounds? bounds) + { + BoundsValue = bounds; + return Self; + } + + public GeotileGridAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + { + FieldValue = field; + return Self; + } + + public GeotileGridAggregationDescriptor Field(Expression> field) + { + FieldValue = field; + return Self; + } + + public GeotileGridAggregationDescriptor Field(Expression> field) + { + FieldValue = field; + return Self; + } + + public GeotileGridAggregationDescriptor Meta(Func, FluentDictionary> selector) + { + MetaValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + public GeotileGridAggregationDescriptor Precision(double? precision) + { + PrecisionValue = precision; + return Self; + } + + public GeotileGridAggregationDescriptor ShardSize(int? shardSize) + { + ShardSizeValue = shardSize; + return Self; + } + + public GeotileGridAggregationDescriptor Size(int? size) + { + SizeValue = size; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("geotile_grid"); + writer.WriteStartObject(); + if (BoundsValue is not null) + { + writer.WritePropertyName("bounds"); + JsonSerializer.Serialize(writer, BoundsValue, options); + } + + if (FieldValue is not null) + { + writer.WritePropertyName("field"); + JsonSerializer.Serialize(writer, FieldValue, options); + } + + if (PrecisionValue is not null) + { + writer.WritePropertyName("precision"); + JsonSerializer.Serialize(writer, PrecisionValue, options); + } + + if (ShardSizeValue.HasValue) + { + writer.WritePropertyName("shard_size"); + writer.WriteNumberValue(ShardSizeValue.Value); + } + + if (SizeValue.HasValue) + { + writer.WritePropertyName("size"); + writer.WriteNumberValue(SizeValue.Value); + } + + writer.WriteEndObject(); + if (MetaValue is not null) + { + writer.WritePropertyName("meta"); + JsonSerializer.Serialize(writer, MetaValue, options); + } + + if (AggregationsDescriptor is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, AggregationsDescriptor, options); + } + else if (AggregationsDescriptorAction is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, new AggregationDescriptor(AggregationsDescriptorAction), options); + } + else if (AggregationsValue is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, AggregationsValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeotileGridBucket.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeotileGridBucket.g.cs new file mode 100644 index 00000000000..4e5b857d319 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeotileGridBucket.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. +// +// ------------------------------------------------ + +#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; + +[JsonConverter(typeof(GeotileGridBucketConverter))] +public sealed partial class GeotileGridBucket : AggregateDictionary +{ + public GeotileGridBucket(IReadOnlyDictionary backingDictionary) : base(backingDictionary) + { + } + + [JsonInclude, JsonPropertyName("doc_count")] + public long DocCount { get; init; } + [JsonInclude, JsonPropertyName("key")] + public string Key { get; init; } +} + +internal sealed class GeotileGridBucketConverter : JsonConverter +{ + public override GeotileGridBucket? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + throw new JsonException($"Expected {JsonTokenType.StartObject} but read {reader.TokenType}."); + var subAggs = new Dictionary();// TODO - Optimise this and only create if we need it. + long docCount = default; + string key = default; + while (reader.Read()) + { + if (reader.TokenType == JsonTokenType.EndObject) + break; + if (reader.TokenType != JsonTokenType.PropertyName) + throw new JsonException($"Expected {JsonTokenType.PropertyName} but read {reader.TokenType}."); + var name = reader.GetString();// TODO: Future optimisation, get raw bytes span and parse based on those + reader.Read(); + if (name.Equals("doc_count", StringComparison.Ordinal)) + { + docCount = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (name.Equals("key", StringComparison.Ordinal)) + { + key = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (name.Contains("#")) + { + AggregateDictionaryConverter.ReadAggregate(ref reader, options, subAggs, name); + continue; + } + + throw new JsonException("Unknown property read from JSON."); + } + + return new GeotileGridBucket(subAggs) { DocCount = docCount, Key = key }; + } + + public override void Write(Utf8JsonWriter writer, GeotileGridBucket value, JsonSerializerOptions options) => throw new NotImplementedException(); +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GoogleNormalizedDistanceHeuristic.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GoogleNormalizedDistanceHeuristic.g.cs new file mode 100644 index 00000000000..53e547e6721 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GoogleNormalizedDistanceHeuristic.g.cs @@ -0,0 +1,63 @@ +// 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 GoogleNormalizedDistanceHeuristic +{ + [JsonInclude, JsonPropertyName("background_is_superset")] + public bool? BackgroundIsSuperset { get; set; } +} + +public sealed partial class GoogleNormalizedDistanceHeuristicDescriptor : SerializableDescriptor +{ + internal GoogleNormalizedDistanceHeuristicDescriptor(Action configure) => configure.Invoke(this); + + public GoogleNormalizedDistanceHeuristicDescriptor() : base() + { + } + + private bool? BackgroundIsSupersetValue { get; set; } + + public GoogleNormalizedDistanceHeuristicDescriptor BackgroundIsSuperset(bool? backgroundIsSuperset = true) + { + BackgroundIsSupersetValue = backgroundIsSuperset; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (BackgroundIsSupersetValue.HasValue) + { + writer.WritePropertyName("background_is_superset"); + writer.WriteBooleanValue(BackgroundIsSupersetValue.Value); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file 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 f5a32a00153..4334972643f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/InferenceAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/InferenceAggregation.g.cs @@ -94,11 +94,7 @@ public override InferenceAggregation Read(ref Utf8JsonReader reader, Type typeTo { reader.Read(); var value = JsonSerializer.Deserialize(ref reader, options); - if (value is not null) - { - agg.ModelId = value; - } - + agg.ModelId = value; continue; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/IpPrefixAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/IpPrefixAggregate.g.cs new file mode 100644 index 00000000000..ecd1258985b --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/IpPrefixAggregate.g.cs @@ -0,0 +1,36 @@ +// 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 IpPrefixAggregate : IAggregate +{ + [JsonInclude, JsonPropertyName("buckets")] + public IReadOnlyCollection Buckets { get; init; } + [JsonInclude, JsonPropertyName("meta")] + public IReadOnlyDictionary? Meta { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/IpPrefixAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/IpPrefixAggregation.g.cs new file mode 100644 index 00000000000..fcefcf7356e --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/IpPrefixAggregation.g.cs @@ -0,0 +1,587 @@ +// 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; + +internal sealed class IpPrefixAggregationConverter : JsonConverter +{ + public override IpPrefixAggregation Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + throw new JsonException("Unexpected JSON detected."); + reader.Read(); + var aggName = reader.GetString(); + if (aggName != "ip_prefix") + throw new JsonException("Unexpected JSON detected."); + var agg = new IpPrefixAggregation(aggName); + while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + { + if (reader.TokenType == JsonTokenType.PropertyName) + { + if (reader.ValueTextEquals("append_prefix_length")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.AppendPrefixLength = value; + } + + continue; + } + + if (reader.ValueTextEquals("field")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + agg.Field = value; + continue; + } + + if (reader.ValueTextEquals("is_ipv6")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.IsIpv6 = value; + } + + continue; + } + + if (reader.ValueTextEquals("keyed")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.Keyed = value; + } + + continue; + } + + if (reader.ValueTextEquals("min_doc_count")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.MinDocCount = value; + } + + continue; + } + + if (reader.ValueTextEquals("prefix_length")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + agg.PrefixLength = value; + continue; + } + } + } + + while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + { + if (reader.TokenType == JsonTokenType.PropertyName) + { + if (reader.ValueTextEquals("meta")) + { + var value = JsonSerializer.Deserialize>(ref reader, options); + if (value is not null) + { + agg.Meta = value; + } + + continue; + } + + if (reader.ValueTextEquals("aggs") || reader.ValueTextEquals("aggregations")) + { + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.Aggregations = value; + } + + continue; + } + } + } + + return agg; + } + + public override void Write(Utf8JsonWriter writer, IpPrefixAggregation value, JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WritePropertyName("ip_prefix"); + writer.WriteStartObject(); + if (value.AppendPrefixLength.HasValue) + { + writer.WritePropertyName("append_prefix_length"); + writer.WriteBooleanValue(value.AppendPrefixLength.Value); + } + + writer.WritePropertyName("field"); + JsonSerializer.Serialize(writer, value.Field, options); + if (value.IsIpv6.HasValue) + { + writer.WritePropertyName("is_ipv6"); + writer.WriteBooleanValue(value.IsIpv6.Value); + } + + if (value.Keyed.HasValue) + { + writer.WritePropertyName("keyed"); + writer.WriteBooleanValue(value.Keyed.Value); + } + + if (value.MinDocCount.HasValue) + { + writer.WritePropertyName("min_doc_count"); + writer.WriteNumberValue(value.MinDocCount.Value); + } + + writer.WritePropertyName("prefix_length"); + writer.WriteNumberValue(value.PrefixLength); + writer.WriteEndObject(); + if (value.Meta is not null) + { + writer.WritePropertyName("meta"); + JsonSerializer.Serialize(writer, value.Meta, options); + } + + if (value.Aggregations is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, value.Aggregations, options); + } + + writer.WriteEndObject(); + } +} + +[JsonConverter(typeof(IpPrefixAggregationConverter))] +public sealed partial class IpPrefixAggregation : SearchAggregation +{ + public IpPrefixAggregation(string name) => Name = name; + + internal IpPrefixAggregation() + { + } + + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDictionary? Aggregations { get; set; } + + /// + /// Defines whether the prefix length is appended to IP address keys in the response. + /// + public bool? AppendPrefixLength { get; set; } + + /// + /// The document IP address field to aggregation on. The field mapping type must be `ip` + /// + public Elastic.Clients.Elasticsearch.Field Field { get; set; } + + /// + /// Defines whether the prefix applies to IPv6 addresses. + /// + public bool? IsIpv6 { get; set; } + + /// + /// Defines whether buckets are returned as a hash rather than an array in the response. + /// + public bool? Keyed { get; set; } + public IDictionary? Meta { get; set; } + + /// + /// Minimum number of documents for buckets to be included in the response. + /// + public long? MinDocCount { get; set; } + override public string? Name { get; internal set; } + + /// + /// Length of the network prefix. For IPv4 addresses the accepted range is [0, 32].
For IPv6 addresses the accepted range is [0, 128].
+ ///
+ public int PrefixLength { get; set; } +} + +public sealed partial class IpPrefixAggregationDescriptor : SerializableDescriptor> +{ + internal IpPrefixAggregationDescriptor(Action> configure) => configure.Invoke(this); + + public IpPrefixAggregationDescriptor() : base() + { + } + + private Elastic.Clients.Elasticsearch.Aggregations.AggregationDictionary? AggregationsValue { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor AggregationsDescriptor { get; set; } + private Action> AggregationsDescriptorAction { get; set; } + private bool? AppendPrefixLengthValue { get; set; } + private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } + private bool? IsIpv6Value { get; set; } + private bool? KeyedValue { get; set; } + private IDictionary? MetaValue { get; set; } + private long? MinDocCountValue { get; set; } + private int PrefixLengthValue { get; set; } + + public IpPrefixAggregationDescriptor Aggregations(Elastic.Clients.Elasticsearch.Aggregations.AggregationDictionary? aggregations) + { + AggregationsDescriptor = null; + AggregationsDescriptorAction = null; + AggregationsValue = aggregations; + return Self; + } + + public IpPrefixAggregationDescriptor Aggregations(Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor descriptor) + { + AggregationsValue = null; + AggregationsDescriptorAction = null; + AggregationsDescriptor = descriptor; + return Self; + } + + public IpPrefixAggregationDescriptor Aggregations(Action> configure) + { + AggregationsValue = null; + AggregationsDescriptor = null; + AggregationsDescriptorAction = configure; + return Self; + } + + /// + /// Defines whether the prefix length is appended to IP address keys in the response. + /// + public IpPrefixAggregationDescriptor AppendPrefixLength(bool? appendPrefixLength = true) + { + AppendPrefixLengthValue = appendPrefixLength; + return Self; + } + + /// + /// The document IP address field to aggregation on. The field mapping type must be `ip` + /// + public IpPrefixAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + { + FieldValue = field; + return Self; + } + + /// + /// The document IP address field to aggregation on. The field mapping type must be `ip` + /// + public IpPrefixAggregationDescriptor Field(Expression> field) + { + FieldValue = field; + return Self; + } + + /// + /// Defines whether the prefix applies to IPv6 addresses. + /// + public IpPrefixAggregationDescriptor IsIpv6(bool? isIpv6 = true) + { + IsIpv6Value = isIpv6; + return Self; + } + + /// + /// Defines whether buckets are returned as a hash rather than an array in the response. + /// + public IpPrefixAggregationDescriptor Keyed(bool? keyed = true) + { + KeyedValue = keyed; + return Self; + } + + public IpPrefixAggregationDescriptor Meta(Func, FluentDictionary> selector) + { + MetaValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + /// + /// Minimum number of documents for buckets to be included in the response. + /// + public IpPrefixAggregationDescriptor MinDocCount(long? minDocCount) + { + MinDocCountValue = minDocCount; + return Self; + } + + /// + /// Length of the network prefix. For IPv4 addresses the accepted range is [0, 32].
For IPv6 addresses the accepted range is [0, 128].
+ ///
+ public IpPrefixAggregationDescriptor PrefixLength(int prefixLength) + { + PrefixLengthValue = prefixLength; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("ip_prefix"); + writer.WriteStartObject(); + if (AppendPrefixLengthValue.HasValue) + { + writer.WritePropertyName("append_prefix_length"); + writer.WriteBooleanValue(AppendPrefixLengthValue.Value); + } + + writer.WritePropertyName("field"); + JsonSerializer.Serialize(writer, FieldValue, options); + if (IsIpv6Value.HasValue) + { + writer.WritePropertyName("is_ipv6"); + writer.WriteBooleanValue(IsIpv6Value.Value); + } + + if (KeyedValue.HasValue) + { + writer.WritePropertyName("keyed"); + writer.WriteBooleanValue(KeyedValue.Value); + } + + if (MinDocCountValue.HasValue) + { + writer.WritePropertyName("min_doc_count"); + writer.WriteNumberValue(MinDocCountValue.Value); + } + + writer.WritePropertyName("prefix_length"); + writer.WriteNumberValue(PrefixLengthValue); + writer.WriteEndObject(); + if (MetaValue is not null) + { + writer.WritePropertyName("meta"); + JsonSerializer.Serialize(writer, MetaValue, options); + } + + if (AggregationsDescriptor is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, AggregationsDescriptor, options); + } + else if (AggregationsDescriptorAction is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, new AggregationDescriptor(AggregationsDescriptorAction), options); + } + else if (AggregationsValue is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, AggregationsValue, options); + } + + writer.WriteEndObject(); + } +} + +public sealed partial class IpPrefixAggregationDescriptor : SerializableDescriptor +{ + internal IpPrefixAggregationDescriptor(Action configure) => configure.Invoke(this); + + public IpPrefixAggregationDescriptor() : base() + { + } + + private Elastic.Clients.Elasticsearch.Aggregations.AggregationDictionary? AggregationsValue { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor AggregationsDescriptor { get; set; } + private Action AggregationsDescriptorAction { get; set; } + private bool? AppendPrefixLengthValue { get; set; } + private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } + private bool? IsIpv6Value { get; set; } + private bool? KeyedValue { get; set; } + private IDictionary? MetaValue { get; set; } + private long? MinDocCountValue { get; set; } + private int PrefixLengthValue { get; set; } + + public IpPrefixAggregationDescriptor Aggregations(Elastic.Clients.Elasticsearch.Aggregations.AggregationDictionary? aggregations) + { + AggregationsDescriptor = null; + AggregationsDescriptorAction = null; + AggregationsValue = aggregations; + return Self; + } + + public IpPrefixAggregationDescriptor Aggregations(Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor descriptor) + { + AggregationsValue = null; + AggregationsDescriptorAction = null; + AggregationsDescriptor = descriptor; + return Self; + } + + public IpPrefixAggregationDescriptor Aggregations(Action configure) + { + AggregationsValue = null; + AggregationsDescriptor = null; + AggregationsDescriptorAction = configure; + return Self; + } + + /// + /// Defines whether the prefix length is appended to IP address keys in the response. + /// + public IpPrefixAggregationDescriptor AppendPrefixLength(bool? appendPrefixLength = true) + { + AppendPrefixLengthValue = appendPrefixLength; + return Self; + } + + /// + /// The document IP address field to aggregation on. The field mapping type must be `ip` + /// + public IpPrefixAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + { + FieldValue = field; + return Self; + } + + /// + /// The document IP address field to aggregation on. The field mapping type must be `ip` + /// + public IpPrefixAggregationDescriptor Field(Expression> field) + { + FieldValue = field; + return Self; + } + + /// + /// The document IP address field to aggregation on. The field mapping type must be `ip` + /// + public IpPrefixAggregationDescriptor Field(Expression> field) + { + FieldValue = field; + return Self; + } + + /// + /// Defines whether the prefix applies to IPv6 addresses. + /// + public IpPrefixAggregationDescriptor IsIpv6(bool? isIpv6 = true) + { + IsIpv6Value = isIpv6; + return Self; + } + + /// + /// Defines whether buckets are returned as a hash rather than an array in the response. + /// + public IpPrefixAggregationDescriptor Keyed(bool? keyed = true) + { + KeyedValue = keyed; + return Self; + } + + public IpPrefixAggregationDescriptor Meta(Func, FluentDictionary> selector) + { + MetaValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + /// + /// Minimum number of documents for buckets to be included in the response. + /// + public IpPrefixAggregationDescriptor MinDocCount(long? minDocCount) + { + MinDocCountValue = minDocCount; + return Self; + } + + /// + /// Length of the network prefix. For IPv4 addresses the accepted range is [0, 32].
For IPv6 addresses the accepted range is [0, 128].
+ ///
+ public IpPrefixAggregationDescriptor PrefixLength(int prefixLength) + { + PrefixLengthValue = prefixLength; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("ip_prefix"); + writer.WriteStartObject(); + if (AppendPrefixLengthValue.HasValue) + { + writer.WritePropertyName("append_prefix_length"); + writer.WriteBooleanValue(AppendPrefixLengthValue.Value); + } + + writer.WritePropertyName("field"); + JsonSerializer.Serialize(writer, FieldValue, options); + if (IsIpv6Value.HasValue) + { + writer.WritePropertyName("is_ipv6"); + writer.WriteBooleanValue(IsIpv6Value.Value); + } + + if (KeyedValue.HasValue) + { + writer.WritePropertyName("keyed"); + writer.WriteBooleanValue(KeyedValue.Value); + } + + if (MinDocCountValue.HasValue) + { + writer.WritePropertyName("min_doc_count"); + writer.WriteNumberValue(MinDocCountValue.Value); + } + + writer.WritePropertyName("prefix_length"); + writer.WriteNumberValue(PrefixLengthValue); + writer.WriteEndObject(); + if (MetaValue is not null) + { + writer.WritePropertyName("meta"); + JsonSerializer.Serialize(writer, MetaValue, options); + } + + if (AggregationsDescriptor is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, AggregationsDescriptor, options); + } + else if (AggregationsDescriptorAction is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, new AggregationDescriptor(AggregationsDescriptorAction), options); + } + else if (AggregationsValue is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, AggregationsValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/IpPrefixBucket.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/IpPrefixBucket.g.cs new file mode 100644 index 00000000000..d4da55c97d5 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/IpPrefixBucket.g.cs @@ -0,0 +1,112 @@ +// 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; + +[JsonConverter(typeof(IpPrefixBucketConverter))] +public sealed partial class IpPrefixBucket : AggregateDictionary +{ + public IpPrefixBucket(IReadOnlyDictionary backingDictionary) : base(backingDictionary) + { + } + + [JsonInclude, JsonPropertyName("doc_count")] + public long DocCount { get; init; } + [JsonInclude, JsonPropertyName("is_ipv6")] + public bool IsIpv6 { get; init; } + [JsonInclude, JsonPropertyName("key")] + public string Key { get; init; } + [JsonInclude, JsonPropertyName("netmask")] + public string? Netmask { get; init; } + [JsonInclude, JsonPropertyName("prefix_length")] + public int PrefixLength { get; init; } +} + +internal sealed class IpPrefixBucketConverter : JsonConverter +{ + public override IpPrefixBucket? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + throw new JsonException($"Expected {JsonTokenType.StartObject} but read {reader.TokenType}."); + var subAggs = new Dictionary();// TODO - Optimise this and only create if we need it. + long docCount = default; + bool isIpv6 = default; + string key = default; + string? netmask = default; + int prefixLength = default; + while (reader.Read()) + { + if (reader.TokenType == JsonTokenType.EndObject) + break; + if (reader.TokenType != JsonTokenType.PropertyName) + throw new JsonException($"Expected {JsonTokenType.PropertyName} but read {reader.TokenType}."); + var name = reader.GetString();// TODO: Future optimisation, get raw bytes span and parse based on those + reader.Read(); + if (name.Equals("doc_count", StringComparison.Ordinal)) + { + docCount = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (name.Equals("is_ipv6", StringComparison.Ordinal)) + { + isIpv6 = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (name.Equals("key", StringComparison.Ordinal)) + { + key = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (name.Equals("netmask", StringComparison.Ordinal)) + { + netmask = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (name.Equals("prefix_length", StringComparison.Ordinal)) + { + prefixLength = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (name.Contains("#")) + { + AggregateDictionaryConverter.ReadAggregate(ref reader, options, subAggs, name); + continue; + } + + throw new JsonException("Unknown property read from JSON."); + } + + return new IpPrefixBucket(subAggs) { DocCount = docCount, IsIpv6 = isIpv6, Key = key, Netmask = netmask, PrefixLength = prefixLength }; + } + + public override void Write(Utf8JsonWriter writer, IpPrefixBucket value, JsonSerializerOptions options) => throw new NotImplementedException(); +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MultiTermsAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MultiTermsAggregation.g.cs index 4f411aa3e0b..ce2493fea4b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MultiTermsAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MultiTermsAggregation.g.cs @@ -130,11 +130,7 @@ public override MultiTermsAggregation Read(ref Utf8JsonReader reader, Type typeT { reader.Read(); var value = JsonSerializer.Deserialize>(ref reader, options); - if (value is not null) - { - agg.Terms = value; - } - + agg.Terms = value; continue; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MutualInformationHeuristic.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MutualInformationHeuristic.g.cs new file mode 100644 index 00000000000..b22372039b5 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MutualInformationHeuristic.g.cs @@ -0,0 +1,78 @@ +// 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 MutualInformationHeuristic +{ + [JsonInclude, JsonPropertyName("background_is_superset")] + public bool? BackgroundIsSuperset { get; set; } + [JsonInclude, JsonPropertyName("include_negatives")] + public bool? IncludeNegatives { get; set; } +} + +public sealed partial class MutualInformationHeuristicDescriptor : SerializableDescriptor +{ + internal MutualInformationHeuristicDescriptor(Action configure) => configure.Invoke(this); + + public MutualInformationHeuristicDescriptor() : base() + { + } + + private bool? BackgroundIsSupersetValue { get; set; } + private bool? IncludeNegativesValue { get; set; } + + public MutualInformationHeuristicDescriptor BackgroundIsSuperset(bool? backgroundIsSuperset = true) + { + BackgroundIsSupersetValue = backgroundIsSuperset; + return Self; + } + + public MutualInformationHeuristicDescriptor IncludeNegatives(bool? includeNegatives = true) + { + IncludeNegativesValue = includeNegatives; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (BackgroundIsSupersetValue.HasValue) + { + writer.WritePropertyName("background_is_superset"); + writer.WriteBooleanValue(BackgroundIsSupersetValue.Value); + } + + if (IncludeNegativesValue.HasValue) + { + writer.WritePropertyName("include_negatives"); + writer.WriteBooleanValue(IncludeNegativesValue.Value); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/PercentageScoreHeuristic.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/PercentageScoreHeuristic.g.cs new file mode 100644 index 00000000000..6f4fd2782fa --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/PercentageScoreHeuristic.g.cs @@ -0,0 +1,45 @@ +// 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 PercentageScoreHeuristic +{ +} + +public sealed partial class PercentageScoreHeuristicDescriptor : SerializableDescriptor +{ + internal PercentageScoreHeuristicDescriptor(Action configure) => configure.Invoke(this); + + public PercentageScoreHeuristicDescriptor() : base() + { + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/RareTermsAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/RareTermsAggregation.g.cs new file mode 100644 index 00000000000..0c500a914bb --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/RareTermsAggregation.g.cs @@ -0,0 +1,595 @@ +// 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; + +internal sealed class RareTermsAggregationConverter : JsonConverter +{ + public override RareTermsAggregation Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + throw new JsonException("Unexpected JSON detected."); + reader.Read(); + var aggName = reader.GetString(); + if (aggName != "rare_terms") + throw new JsonException("Unexpected JSON detected."); + var agg = new RareTermsAggregation(aggName); + while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + { + if (reader.TokenType == JsonTokenType.PropertyName) + { + if (reader.ValueTextEquals("exclude")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.Exclude = value; + } + + continue; + } + + if (reader.ValueTextEquals("field")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.Field = value; + } + + continue; + } + + if (reader.ValueTextEquals("include")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.Include = value; + } + + continue; + } + + if (reader.ValueTextEquals("max_doc_count")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.MaxDocCount = value; + } + + continue; + } + + if (reader.ValueTextEquals("missing")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.Missing = value; + } + + continue; + } + + if (reader.ValueTextEquals("precision")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.Precision = value; + } + + continue; + } + + if (reader.ValueTextEquals("value_type")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.ValueType = value; + } + + continue; + } + } + } + + while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + { + if (reader.TokenType == JsonTokenType.PropertyName) + { + if (reader.ValueTextEquals("meta")) + { + var value = JsonSerializer.Deserialize>(ref reader, options); + if (value is not null) + { + agg.Meta = value; + } + + continue; + } + + if (reader.ValueTextEquals("aggs") || reader.ValueTextEquals("aggregations")) + { + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.Aggregations = value; + } + + continue; + } + } + } + + return agg; + } + + public override void Write(Utf8JsonWriter writer, RareTermsAggregation value, JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WritePropertyName("rare_terms"); + writer.WriteStartObject(); + if (value.Exclude is not null) + { + writer.WritePropertyName("exclude"); + JsonSerializer.Serialize(writer, value.Exclude, options); + } + + if (value.Field is not null) + { + writer.WritePropertyName("field"); + JsonSerializer.Serialize(writer, value.Field, options); + } + + if (value.Include is not null) + { + writer.WritePropertyName("include"); + JsonSerializer.Serialize(writer, value.Include, options); + } + + if (value.MaxDocCount.HasValue) + { + writer.WritePropertyName("max_doc_count"); + writer.WriteNumberValue(value.MaxDocCount.Value); + } + + if (value.Missing is not null) + { + writer.WritePropertyName("missing"); + JsonSerializer.Serialize(writer, value.Missing, options); + } + + if (value.Precision.HasValue) + { + writer.WritePropertyName("precision"); + writer.WriteNumberValue(value.Precision.Value); + } + + if (!string.IsNullOrEmpty(value.ValueType)) + { + writer.WritePropertyName("value_type"); + writer.WriteStringValue(value.ValueType); + } + + writer.WriteEndObject(); + if (value.Meta is not null) + { + writer.WritePropertyName("meta"); + JsonSerializer.Serialize(writer, value.Meta, options); + } + + if (value.Aggregations is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, value.Aggregations, options); + } + + writer.WriteEndObject(); + } +} + +[JsonConverter(typeof(RareTermsAggregationConverter))] +public sealed partial class RareTermsAggregation : SearchAggregation +{ + public RareTermsAggregation(string name) => Name = name; + + internal RareTermsAggregation() + { + } + + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDictionary? Aggregations { get; set; } + public Elastic.Clients.Elasticsearch.Aggregations.TermsExclude? Exclude { get; set; } + public Elastic.Clients.Elasticsearch.Field? Field { get; set; } + public Elastic.Clients.Elasticsearch.Aggregations.TermsInclude? Include { get; set; } + public long? MaxDocCount { get; set; } + public IDictionary? Meta { get; set; } + public FieldValue? Missing { get; set; } + override public string? Name { get; internal set; } + public double? Precision { get; set; } + public string? ValueType { get; set; } +} + +public sealed partial class RareTermsAggregationDescriptor : SerializableDescriptor> +{ + internal RareTermsAggregationDescriptor(Action> configure) => configure.Invoke(this); + + public RareTermsAggregationDescriptor() : base() + { + } + + private Elastic.Clients.Elasticsearch.Aggregations.AggregationDictionary? AggregationsValue { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor AggregationsDescriptor { get; set; } + private Action> AggregationsDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.TermsExclude? ExcludeValue { get; set; } + private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.TermsInclude? IncludeValue { get; set; } + private long? MaxDocCountValue { get; set; } + private IDictionary? MetaValue { get; set; } + private FieldValue? MissingValue { get; set; } + private double? PrecisionValue { get; set; } + private string? ValueTypeValue { get; set; } + + public RareTermsAggregationDescriptor Aggregations(Elastic.Clients.Elasticsearch.Aggregations.AggregationDictionary? aggregations) + { + AggregationsDescriptor = null; + AggregationsDescriptorAction = null; + AggregationsValue = aggregations; + return Self; + } + + public RareTermsAggregationDescriptor Aggregations(Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor descriptor) + { + AggregationsValue = null; + AggregationsDescriptorAction = null; + AggregationsDescriptor = descriptor; + return Self; + } + + public RareTermsAggregationDescriptor Aggregations(Action> configure) + { + AggregationsValue = null; + AggregationsDescriptor = null; + AggregationsDescriptorAction = configure; + return Self; + } + + public RareTermsAggregationDescriptor Exclude(Elastic.Clients.Elasticsearch.Aggregations.TermsExclude? exclude) + { + ExcludeValue = exclude; + return Self; + } + + public RareTermsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + { + FieldValue = field; + return Self; + } + + public RareTermsAggregationDescriptor Field(Expression> field) + { + FieldValue = field; + return Self; + } + + public RareTermsAggregationDescriptor Include(Elastic.Clients.Elasticsearch.Aggregations.TermsInclude? include) + { + IncludeValue = include; + return Self; + } + + public RareTermsAggregationDescriptor MaxDocCount(long? maxDocCount) + { + MaxDocCountValue = maxDocCount; + return Self; + } + + public RareTermsAggregationDescriptor Meta(Func, FluentDictionary> selector) + { + MetaValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + public RareTermsAggregationDescriptor Missing(FieldValue? missing) + { + MissingValue = missing; + return Self; + } + + public RareTermsAggregationDescriptor Precision(double? precision) + { + PrecisionValue = precision; + return Self; + } + + public RareTermsAggregationDescriptor ValueType(string? valueType) + { + ValueTypeValue = valueType; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("rare_terms"); + writer.WriteStartObject(); + if (ExcludeValue is not null) + { + writer.WritePropertyName("exclude"); + JsonSerializer.Serialize(writer, ExcludeValue, options); + } + + if (FieldValue is not null) + { + writer.WritePropertyName("field"); + JsonSerializer.Serialize(writer, FieldValue, options); + } + + if (IncludeValue is not null) + { + writer.WritePropertyName("include"); + JsonSerializer.Serialize(writer, IncludeValue, options); + } + + if (MaxDocCountValue.HasValue) + { + writer.WritePropertyName("max_doc_count"); + writer.WriteNumberValue(MaxDocCountValue.Value); + } + + if (MissingValue is not null) + { + writer.WritePropertyName("missing"); + JsonSerializer.Serialize(writer, MissingValue, options); + } + + if (PrecisionValue.HasValue) + { + writer.WritePropertyName("precision"); + writer.WriteNumberValue(PrecisionValue.Value); + } + + if (!string.IsNullOrEmpty(ValueTypeValue)) + { + writer.WritePropertyName("value_type"); + writer.WriteStringValue(ValueTypeValue); + } + + writer.WriteEndObject(); + if (MetaValue is not null) + { + writer.WritePropertyName("meta"); + JsonSerializer.Serialize(writer, MetaValue, options); + } + + if (AggregationsDescriptor is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, AggregationsDescriptor, options); + } + else if (AggregationsDescriptorAction is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, new AggregationDescriptor(AggregationsDescriptorAction), options); + } + else if (AggregationsValue is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, AggregationsValue, options); + } + + writer.WriteEndObject(); + } +} + +public sealed partial class RareTermsAggregationDescriptor : SerializableDescriptor +{ + internal RareTermsAggregationDescriptor(Action configure) => configure.Invoke(this); + + public RareTermsAggregationDescriptor() : base() + { + } + + private Elastic.Clients.Elasticsearch.Aggregations.AggregationDictionary? AggregationsValue { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor AggregationsDescriptor { get; set; } + private Action AggregationsDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.TermsExclude? ExcludeValue { get; set; } + private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.TermsInclude? IncludeValue { get; set; } + private long? MaxDocCountValue { get; set; } + private IDictionary? MetaValue { get; set; } + private FieldValue? MissingValue { get; set; } + private double? PrecisionValue { get; set; } + private string? ValueTypeValue { get; set; } + + public RareTermsAggregationDescriptor Aggregations(Elastic.Clients.Elasticsearch.Aggregations.AggregationDictionary? aggregations) + { + AggregationsDescriptor = null; + AggregationsDescriptorAction = null; + AggregationsValue = aggregations; + return Self; + } + + public RareTermsAggregationDescriptor Aggregations(Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor descriptor) + { + AggregationsValue = null; + AggregationsDescriptorAction = null; + AggregationsDescriptor = descriptor; + return Self; + } + + public RareTermsAggregationDescriptor Aggregations(Action configure) + { + AggregationsValue = null; + AggregationsDescriptor = null; + AggregationsDescriptorAction = configure; + return Self; + } + + public RareTermsAggregationDescriptor Exclude(Elastic.Clients.Elasticsearch.Aggregations.TermsExclude? exclude) + { + ExcludeValue = exclude; + return Self; + } + + public RareTermsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + { + FieldValue = field; + return Self; + } + + public RareTermsAggregationDescriptor Field(Expression> field) + { + FieldValue = field; + return Self; + } + + public RareTermsAggregationDescriptor Field(Expression> field) + { + FieldValue = field; + return Self; + } + + public RareTermsAggregationDescriptor Include(Elastic.Clients.Elasticsearch.Aggregations.TermsInclude? include) + { + IncludeValue = include; + return Self; + } + + public RareTermsAggregationDescriptor MaxDocCount(long? maxDocCount) + { + MaxDocCountValue = maxDocCount; + return Self; + } + + public RareTermsAggregationDescriptor Meta(Func, FluentDictionary> selector) + { + MetaValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + public RareTermsAggregationDescriptor Missing(FieldValue? missing) + { + MissingValue = missing; + return Self; + } + + public RareTermsAggregationDescriptor Precision(double? precision) + { + PrecisionValue = precision; + return Self; + } + + public RareTermsAggregationDescriptor ValueType(string? valueType) + { + ValueTypeValue = valueType; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("rare_terms"); + writer.WriteStartObject(); + if (ExcludeValue is not null) + { + writer.WritePropertyName("exclude"); + JsonSerializer.Serialize(writer, ExcludeValue, options); + } + + if (FieldValue is not null) + { + writer.WritePropertyName("field"); + JsonSerializer.Serialize(writer, FieldValue, options); + } + + if (IncludeValue is not null) + { + writer.WritePropertyName("include"); + JsonSerializer.Serialize(writer, IncludeValue, options); + } + + if (MaxDocCountValue.HasValue) + { + writer.WritePropertyName("max_doc_count"); + writer.WriteNumberValue(MaxDocCountValue.Value); + } + + if (MissingValue is not null) + { + writer.WritePropertyName("missing"); + JsonSerializer.Serialize(writer, MissingValue, options); + } + + if (PrecisionValue.HasValue) + { + writer.WritePropertyName("precision"); + writer.WriteNumberValue(PrecisionValue.Value); + } + + if (!string.IsNullOrEmpty(ValueTypeValue)) + { + writer.WritePropertyName("value_type"); + writer.WriteStringValue(ValueTypeValue); + } + + writer.WriteEndObject(); + if (MetaValue is not null) + { + writer.WritePropertyName("meta"); + JsonSerializer.Serialize(writer, MetaValue, options); + } + + if (AggregationsDescriptor is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, AggregationsDescriptor, options); + } + else if (AggregationsDescriptorAction is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, new AggregationDescriptor(AggregationsDescriptorAction), options); + } + else if (AggregationsValue is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, AggregationsValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ScriptedHeuristic.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ScriptedHeuristic.g.cs new file mode 100644 index 00000000000..07131662aeb --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ScriptedHeuristic.g.cs @@ -0,0 +1,59 @@ +// 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 ScriptedHeuristic +{ + [JsonInclude, JsonPropertyName("script")] + public Elastic.Clients.Elasticsearch.Script Script { get; set; } +} + +public sealed partial class ScriptedHeuristicDescriptor : SerializableDescriptor +{ + internal ScriptedHeuristicDescriptor(Action configure) => configure.Invoke(this); + + public ScriptedHeuristicDescriptor() : base() + { + } + + private Elastic.Clients.Elasticsearch.Script ScriptValue { get; set; } + + public ScriptedHeuristicDescriptor Script(Elastic.Clients.Elasticsearch.Script script) + { + ScriptValue = script; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("script"); + JsonSerializer.Serialize(writer, ScriptValue, options); + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SignificantStringTermsAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SignificantStringTermsAggregate.g.cs new file mode 100644 index 00000000000..e2e799a941e --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SignificantStringTermsAggregate.g.cs @@ -0,0 +1,40 @@ +// 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 SignificantStringTermsAggregate : IAggregate +{ + [JsonInclude, JsonPropertyName("bg_count")] + public long? BgCount { get; init; } + [JsonInclude, JsonPropertyName("buckets")] + public IReadOnlyCollection Buckets { get; init; } + [JsonInclude, JsonPropertyName("doc_count")] + public long? DocCount { get; init; } + [JsonInclude, JsonPropertyName("meta")] + public IReadOnlyDictionary? Meta { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SignificantStringTermsBucket.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SignificantStringTermsBucket.g.cs new file mode 100644 index 00000000000..d24755a7daf --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SignificantStringTermsBucket.g.cs @@ -0,0 +1,103 @@ +// 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; + +[JsonConverter(typeof(SignificantStringTermsBucketConverter))] +public sealed partial class SignificantStringTermsBucket : AggregateDictionary +{ + public SignificantStringTermsBucket(IReadOnlyDictionary backingDictionary) : base(backingDictionary) + { + } + + [JsonInclude, JsonPropertyName("bg_count")] + public long BgCount { get; init; } + [JsonInclude, JsonPropertyName("doc_count")] + public long DocCount { get; init; } + [JsonInclude, JsonPropertyName("key")] + public string Key { get; init; } + [JsonInclude, JsonPropertyName("score")] + public double Score { get; init; } +} + +internal sealed class SignificantStringTermsBucketConverter : JsonConverter +{ + public override SignificantStringTermsBucket? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + throw new JsonException($"Expected {JsonTokenType.StartObject} but read {reader.TokenType}."); + var subAggs = new Dictionary();// TODO - Optimise this and only create if we need it. + long bgCount = default; + long docCount = default; + string key = default; + double score = default; + while (reader.Read()) + { + if (reader.TokenType == JsonTokenType.EndObject) + break; + if (reader.TokenType != JsonTokenType.PropertyName) + throw new JsonException($"Expected {JsonTokenType.PropertyName} but read {reader.TokenType}."); + var name = reader.GetString();// TODO: Future optimisation, get raw bytes span and parse based on those + reader.Read(); + if (name.Equals("bg_count", StringComparison.Ordinal)) + { + bgCount = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (name.Equals("doc_count", StringComparison.Ordinal)) + { + docCount = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (name.Equals("key", StringComparison.Ordinal)) + { + key = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (name.Equals("score", StringComparison.Ordinal)) + { + score = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (name.Contains("#")) + { + AggregateDictionaryConverter.ReadAggregate(ref reader, options, subAggs, name); + continue; + } + + throw new JsonException("Unknown property read from JSON."); + } + + return new SignificantStringTermsBucket(subAggs) { BgCount = bgCount, DocCount = docCount, Key = key, Score = score }; + } + + public override void Write(Utf8JsonWriter writer, SignificantStringTermsBucket value, JsonSerializerOptions options) => throw new NotImplementedException(); +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SignificantTermsAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SignificantTermsAggregation.g.cs new file mode 100644 index 00000000000..7542c60db67 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SignificantTermsAggregation.g.cs @@ -0,0 +1,1375 @@ +// 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; + +internal sealed class SignificantTermsAggregationConverter : JsonConverter +{ + public override SignificantTermsAggregation Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + throw new JsonException("Unexpected JSON detected."); + reader.Read(); + var aggName = reader.GetString(); + if (aggName != "significant_terms") + throw new JsonException("Unexpected JSON detected."); + var agg = new SignificantTermsAggregation(aggName); + while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + { + if (reader.TokenType == JsonTokenType.PropertyName) + { + if (reader.ValueTextEquals("background_filter")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.BackgroundFilter = value; + } + + continue; + } + + if (reader.ValueTextEquals("chi_square")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.ChiSquare = value; + } + + continue; + } + + if (reader.ValueTextEquals("exclude")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.Exclude = value; + } + + continue; + } + + if (reader.ValueTextEquals("execution_hint")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.ExecutionHint = value; + } + + continue; + } + + if (reader.ValueTextEquals("field")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.Field = value; + } + + continue; + } + + if (reader.ValueTextEquals("gnd")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.Gnd = value; + } + + continue; + } + + if (reader.ValueTextEquals("include")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.Include = value; + } + + continue; + } + + if (reader.ValueTextEquals("jlh")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.Jlh = value; + } + + continue; + } + + if (reader.ValueTextEquals("min_doc_count")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.MinDocCount = value; + } + + continue; + } + + if (reader.ValueTextEquals("mutual_information")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.MutualInformation = value; + } + + continue; + } + + if (reader.ValueTextEquals("percentage")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.Percentage = value; + } + + continue; + } + + if (reader.ValueTextEquals("script_heuristic")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.ScriptHeuristic = value; + } + + continue; + } + + if (reader.ValueTextEquals("shard_min_doc_count")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.ShardMinDocCount = value; + } + + continue; + } + + if (reader.ValueTextEquals("shard_size")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.ShardSize = value; + } + + continue; + } + + if (reader.ValueTextEquals("size")) + { + reader.Read(); + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.Size = value; + } + + continue; + } + } + } + + while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + { + if (reader.TokenType == JsonTokenType.PropertyName) + { + if (reader.ValueTextEquals("meta")) + { + var value = JsonSerializer.Deserialize>(ref reader, options); + if (value is not null) + { + agg.Meta = value; + } + + continue; + } + + if (reader.ValueTextEquals("aggs") || reader.ValueTextEquals("aggregations")) + { + var value = JsonSerializer.Deserialize(ref reader, options); + if (value is not null) + { + agg.Aggregations = value; + } + + continue; + } + } + } + + return agg; + } + + public override void Write(Utf8JsonWriter writer, SignificantTermsAggregation value, JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WritePropertyName("significant_terms"); + writer.WriteStartObject(); + if (value.BackgroundFilter is not null) + { + writer.WritePropertyName("background_filter"); + JsonSerializer.Serialize(writer, value.BackgroundFilter, options); + } + + if (value.ChiSquare is not null) + { + writer.WritePropertyName("chi_square"); + JsonSerializer.Serialize(writer, value.ChiSquare, options); + } + + if (value.Exclude is not null) + { + writer.WritePropertyName("exclude"); + JsonSerializer.Serialize(writer, value.Exclude, options); + } + + if (value.ExecutionHint is not null) + { + writer.WritePropertyName("execution_hint"); + JsonSerializer.Serialize(writer, value.ExecutionHint, options); + } + + if (value.Field is not null) + { + writer.WritePropertyName("field"); + JsonSerializer.Serialize(writer, value.Field, options); + } + + if (value.Gnd is not null) + { + writer.WritePropertyName("gnd"); + JsonSerializer.Serialize(writer, value.Gnd, options); + } + + if (value.Include is not null) + { + writer.WritePropertyName("include"); + JsonSerializer.Serialize(writer, value.Include, options); + } + + if (value.Jlh is not null) + { + writer.WritePropertyName("jlh"); + JsonSerializer.Serialize(writer, value.Jlh, options); + } + + if (value.MinDocCount.HasValue) + { + writer.WritePropertyName("min_doc_count"); + writer.WriteNumberValue(value.MinDocCount.Value); + } + + if (value.MutualInformation is not null) + { + writer.WritePropertyName("mutual_information"); + JsonSerializer.Serialize(writer, value.MutualInformation, options); + } + + if (value.Percentage is not null) + { + writer.WritePropertyName("percentage"); + JsonSerializer.Serialize(writer, value.Percentage, options); + } + + if (value.ScriptHeuristic is not null) + { + writer.WritePropertyName("script_heuristic"); + JsonSerializer.Serialize(writer, value.ScriptHeuristic, options); + } + + if (value.ShardMinDocCount.HasValue) + { + writer.WritePropertyName("shard_min_doc_count"); + writer.WriteNumberValue(value.ShardMinDocCount.Value); + } + + if (value.ShardSize.HasValue) + { + writer.WritePropertyName("shard_size"); + writer.WriteNumberValue(value.ShardSize.Value); + } + + if (value.Size.HasValue) + { + writer.WritePropertyName("size"); + writer.WriteNumberValue(value.Size.Value); + } + + writer.WriteEndObject(); + if (value.Meta is not null) + { + writer.WritePropertyName("meta"); + JsonSerializer.Serialize(writer, value.Meta, options); + } + + if (value.Aggregations is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, value.Aggregations, options); + } + + writer.WriteEndObject(); + } +} + +[JsonConverter(typeof(SignificantTermsAggregationConverter))] +public sealed partial class SignificantTermsAggregation : SearchAggregation +{ + public SignificantTermsAggregation(string name) => Name = name; + + internal SignificantTermsAggregation() + { + } + + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDictionary? Aggregations { get; set; } + public Elastic.Clients.Elasticsearch.QueryDsl.Query? BackgroundFilter { get; set; } + public Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristic? ChiSquare { get; set; } + public Elastic.Clients.Elasticsearch.Aggregations.TermsExclude? Exclude { get; set; } + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationExecutionHint? ExecutionHint { get; set; } + public Elastic.Clients.Elasticsearch.Field? Field { get; set; } + public Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristic? Gnd { get; set; } + public Elastic.Clients.Elasticsearch.Aggregations.TermsInclude? Include { get; set; } + public Elastic.Clients.Elasticsearch.EmptyObject? Jlh { get; set; } + public IDictionary? Meta { get; set; } + public long? MinDocCount { get; set; } + public Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristic? MutualInformation { get; set; } + override public string? Name { get; internal set; } + public Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristic? Percentage { get; set; } + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristic? ScriptHeuristic { get; set; } + public long? ShardMinDocCount { get; set; } + public int? ShardSize { get; set; } + public int? Size { get; set; } +} + +public sealed partial class SignificantTermsAggregationDescriptor : SerializableDescriptor> +{ + internal SignificantTermsAggregationDescriptor(Action> configure) => configure.Invoke(this); + + public SignificantTermsAggregationDescriptor() : base() + { + } + + private Elastic.Clients.Elasticsearch.Aggregations.AggregationDictionary? AggregationsValue { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor AggregationsDescriptor { get; set; } + private Action> AggregationsDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.QueryDsl.Query? BackgroundFilterValue { get; set; } + private QueryDsl.QueryDescriptor BackgroundFilterDescriptor { get; set; } + private Action> BackgroundFilterDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristic? ChiSquareValue { get; set; } + private ChiSquareHeuristicDescriptor ChiSquareDescriptor { get; set; } + private Action ChiSquareDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.TermsExclude? ExcludeValue { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationExecutionHint? ExecutionHintValue { get; set; } + private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristic? GndValue { get; set; } + private GoogleNormalizedDistanceHeuristicDescriptor GndDescriptor { get; set; } + private Action GndDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.TermsInclude? IncludeValue { get; set; } + private Elastic.Clients.Elasticsearch.EmptyObject? JlhValue { get; set; } + private EmptyObjectDescriptor JlhDescriptor { get; set; } + private Action JlhDescriptorAction { get; set; } + private IDictionary? MetaValue { get; set; } + private long? MinDocCountValue { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristic? MutualInformationValue { get; set; } + private MutualInformationHeuristicDescriptor MutualInformationDescriptor { get; set; } + private Action MutualInformationDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristic? PercentageValue { get; set; } + private PercentageScoreHeuristicDescriptor PercentageDescriptor { get; set; } + private Action PercentageDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristic? ScriptHeuristicValue { get; set; } + private ScriptedHeuristicDescriptor ScriptHeuristicDescriptor { get; set; } + private Action ScriptHeuristicDescriptorAction { get; set; } + private long? ShardMinDocCountValue { get; set; } + private int? ShardSizeValue { get; set; } + private int? SizeValue { get; set; } + + public SignificantTermsAggregationDescriptor Aggregations(Elastic.Clients.Elasticsearch.Aggregations.AggregationDictionary? aggregations) + { + AggregationsDescriptor = null; + AggregationsDescriptorAction = null; + AggregationsValue = aggregations; + return Self; + } + + public SignificantTermsAggregationDescriptor Aggregations(Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor descriptor) + { + AggregationsValue = null; + AggregationsDescriptorAction = null; + AggregationsDescriptor = descriptor; + return Self; + } + + public SignificantTermsAggregationDescriptor Aggregations(Action> configure) + { + AggregationsValue = null; + AggregationsDescriptor = null; + AggregationsDescriptorAction = configure; + return Self; + } + + public SignificantTermsAggregationDescriptor BackgroundFilter(Elastic.Clients.Elasticsearch.QueryDsl.Query? backgroundFilter) + { + BackgroundFilterDescriptor = null; + BackgroundFilterDescriptorAction = null; + BackgroundFilterValue = backgroundFilter; + return Self; + } + + public SignificantTermsAggregationDescriptor BackgroundFilter(QueryDsl.QueryDescriptor descriptor) + { + BackgroundFilterValue = null; + BackgroundFilterDescriptorAction = null; + BackgroundFilterDescriptor = descriptor; + return Self; + } + + public SignificantTermsAggregationDescriptor BackgroundFilter(Action> configure) + { + BackgroundFilterValue = null; + BackgroundFilterDescriptor = null; + BackgroundFilterDescriptorAction = configure; + return Self; + } + + public SignificantTermsAggregationDescriptor ChiSquare(Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristic? chiSquare) + { + ChiSquareDescriptor = null; + ChiSquareDescriptorAction = null; + ChiSquareValue = chiSquare; + return Self; + } + + public SignificantTermsAggregationDescriptor ChiSquare(ChiSquareHeuristicDescriptor descriptor) + { + ChiSquareValue = null; + ChiSquareDescriptorAction = null; + ChiSquareDescriptor = descriptor; + return Self; + } + + public SignificantTermsAggregationDescriptor ChiSquare(Action configure) + { + ChiSquareValue = null; + ChiSquareDescriptor = null; + ChiSquareDescriptorAction = configure; + return Self; + } + + public SignificantTermsAggregationDescriptor Exclude(Elastic.Clients.Elasticsearch.Aggregations.TermsExclude? exclude) + { + ExcludeValue = exclude; + return Self; + } + + public SignificantTermsAggregationDescriptor ExecutionHint(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationExecutionHint? executionHint) + { + ExecutionHintValue = executionHint; + return Self; + } + + public SignificantTermsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + { + FieldValue = field; + return Self; + } + + public SignificantTermsAggregationDescriptor Field(Expression> field) + { + FieldValue = field; + return Self; + } + + public SignificantTermsAggregationDescriptor Gnd(Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristic? gnd) + { + GndDescriptor = null; + GndDescriptorAction = null; + GndValue = gnd; + return Self; + } + + public SignificantTermsAggregationDescriptor Gnd(GoogleNormalizedDistanceHeuristicDescriptor descriptor) + { + GndValue = null; + GndDescriptorAction = null; + GndDescriptor = descriptor; + return Self; + } + + public SignificantTermsAggregationDescriptor Gnd(Action configure) + { + GndValue = null; + GndDescriptor = null; + GndDescriptorAction = configure; + return Self; + } + + public SignificantTermsAggregationDescriptor Include(Elastic.Clients.Elasticsearch.Aggregations.TermsInclude? include) + { + IncludeValue = include; + return Self; + } + + public SignificantTermsAggregationDescriptor Jlh(Elastic.Clients.Elasticsearch.EmptyObject? jlh) + { + JlhDescriptor = null; + JlhDescriptorAction = null; + JlhValue = jlh; + return Self; + } + + public SignificantTermsAggregationDescriptor Jlh(EmptyObjectDescriptor descriptor) + { + JlhValue = null; + JlhDescriptorAction = null; + JlhDescriptor = descriptor; + return Self; + } + + public SignificantTermsAggregationDescriptor Jlh(Action configure) + { + JlhValue = null; + JlhDescriptor = null; + JlhDescriptorAction = configure; + return Self; + } + + public SignificantTermsAggregationDescriptor Meta(Func, FluentDictionary> selector) + { + MetaValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + public SignificantTermsAggregationDescriptor MinDocCount(long? minDocCount) + { + MinDocCountValue = minDocCount; + return Self; + } + + public SignificantTermsAggregationDescriptor MutualInformation(Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristic? mutualInformation) + { + MutualInformationDescriptor = null; + MutualInformationDescriptorAction = null; + MutualInformationValue = mutualInformation; + return Self; + } + + public SignificantTermsAggregationDescriptor MutualInformation(MutualInformationHeuristicDescriptor descriptor) + { + MutualInformationValue = null; + MutualInformationDescriptorAction = null; + MutualInformationDescriptor = descriptor; + return Self; + } + + public SignificantTermsAggregationDescriptor MutualInformation(Action configure) + { + MutualInformationValue = null; + MutualInformationDescriptor = null; + MutualInformationDescriptorAction = configure; + return Self; + } + + public SignificantTermsAggregationDescriptor Percentage(Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristic? percentage) + { + PercentageDescriptor = null; + PercentageDescriptorAction = null; + PercentageValue = percentage; + return Self; + } + + public SignificantTermsAggregationDescriptor Percentage(PercentageScoreHeuristicDescriptor descriptor) + { + PercentageValue = null; + PercentageDescriptorAction = null; + PercentageDescriptor = descriptor; + return Self; + } + + public SignificantTermsAggregationDescriptor Percentage(Action configure) + { + PercentageValue = null; + PercentageDescriptor = null; + PercentageDescriptorAction = configure; + return Self; + } + + public SignificantTermsAggregationDescriptor ScriptHeuristic(Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristic? scriptHeuristic) + { + ScriptHeuristicDescriptor = null; + ScriptHeuristicDescriptorAction = null; + ScriptHeuristicValue = scriptHeuristic; + return Self; + } + + public SignificantTermsAggregationDescriptor ScriptHeuristic(ScriptedHeuristicDescriptor descriptor) + { + ScriptHeuristicValue = null; + ScriptHeuristicDescriptorAction = null; + ScriptHeuristicDescriptor = descriptor; + return Self; + } + + public SignificantTermsAggregationDescriptor ScriptHeuristic(Action configure) + { + ScriptHeuristicValue = null; + ScriptHeuristicDescriptor = null; + ScriptHeuristicDescriptorAction = configure; + return Self; + } + + public SignificantTermsAggregationDescriptor ShardMinDocCount(long? shardMinDocCount) + { + ShardMinDocCountValue = shardMinDocCount; + return Self; + } + + public SignificantTermsAggregationDescriptor ShardSize(int? shardSize) + { + ShardSizeValue = shardSize; + return Self; + } + + public SignificantTermsAggregationDescriptor Size(int? size) + { + SizeValue = size; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("significant_terms"); + writer.WriteStartObject(); + if (BackgroundFilterDescriptor is not null) + { + writer.WritePropertyName("background_filter"); + JsonSerializer.Serialize(writer, BackgroundFilterDescriptor, options); + } + else if (BackgroundFilterDescriptorAction is not null) + { + writer.WritePropertyName("background_filter"); + JsonSerializer.Serialize(writer, new QueryDsl.QueryDescriptor(BackgroundFilterDescriptorAction), options); + } + else if (BackgroundFilterValue is not null) + { + writer.WritePropertyName("background_filter"); + JsonSerializer.Serialize(writer, BackgroundFilterValue, options); + } + + if (ChiSquareDescriptor is not null) + { + writer.WritePropertyName("chi_square"); + JsonSerializer.Serialize(writer, ChiSquareDescriptor, options); + } + else if (ChiSquareDescriptorAction is not null) + { + writer.WritePropertyName("chi_square"); + JsonSerializer.Serialize(writer, new ChiSquareHeuristicDescriptor(ChiSquareDescriptorAction), options); + } + else if (ChiSquareValue is not null) + { + writer.WritePropertyName("chi_square"); + JsonSerializer.Serialize(writer, ChiSquareValue, options); + } + + if (ExcludeValue is not null) + { + writer.WritePropertyName("exclude"); + JsonSerializer.Serialize(writer, ExcludeValue, options); + } + + if (ExecutionHintValue is not null) + { + writer.WritePropertyName("execution_hint"); + JsonSerializer.Serialize(writer, ExecutionHintValue, options); + } + + if (FieldValue is not null) + { + writer.WritePropertyName("field"); + JsonSerializer.Serialize(writer, FieldValue, options); + } + + if (GndDescriptor is not null) + { + writer.WritePropertyName("gnd"); + JsonSerializer.Serialize(writer, GndDescriptor, options); + } + else if (GndDescriptorAction is not null) + { + writer.WritePropertyName("gnd"); + JsonSerializer.Serialize(writer, new GoogleNormalizedDistanceHeuristicDescriptor(GndDescriptorAction), options); + } + else if (GndValue is not null) + { + writer.WritePropertyName("gnd"); + JsonSerializer.Serialize(writer, GndValue, options); + } + + if (IncludeValue is not null) + { + writer.WritePropertyName("include"); + JsonSerializer.Serialize(writer, IncludeValue, options); + } + + if (JlhDescriptor is not null) + { + writer.WritePropertyName("jlh"); + JsonSerializer.Serialize(writer, JlhDescriptor, options); + } + else if (JlhDescriptorAction is not null) + { + writer.WritePropertyName("jlh"); + JsonSerializer.Serialize(writer, new EmptyObjectDescriptor(JlhDescriptorAction), options); + } + else if (JlhValue is not null) + { + writer.WritePropertyName("jlh"); + JsonSerializer.Serialize(writer, JlhValue, options); + } + + if (MinDocCountValue.HasValue) + { + writer.WritePropertyName("min_doc_count"); + writer.WriteNumberValue(MinDocCountValue.Value); + } + + if (MutualInformationDescriptor is not null) + { + writer.WritePropertyName("mutual_information"); + JsonSerializer.Serialize(writer, MutualInformationDescriptor, options); + } + else if (MutualInformationDescriptorAction is not null) + { + writer.WritePropertyName("mutual_information"); + JsonSerializer.Serialize(writer, new MutualInformationHeuristicDescriptor(MutualInformationDescriptorAction), options); + } + else if (MutualInformationValue is not null) + { + writer.WritePropertyName("mutual_information"); + JsonSerializer.Serialize(writer, MutualInformationValue, options); + } + + if (PercentageDescriptor is not null) + { + writer.WritePropertyName("percentage"); + JsonSerializer.Serialize(writer, PercentageDescriptor, options); + } + else if (PercentageDescriptorAction is not null) + { + writer.WritePropertyName("percentage"); + JsonSerializer.Serialize(writer, new PercentageScoreHeuristicDescriptor(PercentageDescriptorAction), options); + } + else if (PercentageValue is not null) + { + writer.WritePropertyName("percentage"); + JsonSerializer.Serialize(writer, PercentageValue, options); + } + + if (ScriptHeuristicDescriptor is not null) + { + writer.WritePropertyName("script_heuristic"); + JsonSerializer.Serialize(writer, ScriptHeuristicDescriptor, options); + } + else if (ScriptHeuristicDescriptorAction is not null) + { + writer.WritePropertyName("script_heuristic"); + JsonSerializer.Serialize(writer, new ScriptedHeuristicDescriptor(ScriptHeuristicDescriptorAction), options); + } + else if (ScriptHeuristicValue is not null) + { + writer.WritePropertyName("script_heuristic"); + JsonSerializer.Serialize(writer, ScriptHeuristicValue, options); + } + + if (ShardMinDocCountValue.HasValue) + { + writer.WritePropertyName("shard_min_doc_count"); + writer.WriteNumberValue(ShardMinDocCountValue.Value); + } + + if (ShardSizeValue.HasValue) + { + writer.WritePropertyName("shard_size"); + writer.WriteNumberValue(ShardSizeValue.Value); + } + + if (SizeValue.HasValue) + { + writer.WritePropertyName("size"); + writer.WriteNumberValue(SizeValue.Value); + } + + writer.WriteEndObject(); + if (MetaValue is not null) + { + writer.WritePropertyName("meta"); + JsonSerializer.Serialize(writer, MetaValue, options); + } + + if (AggregationsDescriptor is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, AggregationsDescriptor, options); + } + else if (AggregationsDescriptorAction is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, new AggregationDescriptor(AggregationsDescriptorAction), options); + } + else if (AggregationsValue is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, AggregationsValue, options); + } + + writer.WriteEndObject(); + } +} + +public sealed partial class SignificantTermsAggregationDescriptor : SerializableDescriptor +{ + internal SignificantTermsAggregationDescriptor(Action configure) => configure.Invoke(this); + + public SignificantTermsAggregationDescriptor() : base() + { + } + + private Elastic.Clients.Elasticsearch.Aggregations.AggregationDictionary? AggregationsValue { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor AggregationsDescriptor { get; set; } + private Action AggregationsDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.QueryDsl.Query? BackgroundFilterValue { get; set; } + private QueryDsl.QueryDescriptor BackgroundFilterDescriptor { get; set; } + private Action BackgroundFilterDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristic? ChiSquareValue { get; set; } + private ChiSquareHeuristicDescriptor ChiSquareDescriptor { get; set; } + private Action ChiSquareDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.TermsExclude? ExcludeValue { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationExecutionHint? ExecutionHintValue { get; set; } + private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristic? GndValue { get; set; } + private GoogleNormalizedDistanceHeuristicDescriptor GndDescriptor { get; set; } + private Action GndDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.TermsInclude? IncludeValue { get; set; } + private Elastic.Clients.Elasticsearch.EmptyObject? JlhValue { get; set; } + private EmptyObjectDescriptor JlhDescriptor { get; set; } + private Action JlhDescriptorAction { get; set; } + private IDictionary? MetaValue { get; set; } + private long? MinDocCountValue { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristic? MutualInformationValue { get; set; } + private MutualInformationHeuristicDescriptor MutualInformationDescriptor { get; set; } + private Action MutualInformationDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristic? PercentageValue { get; set; } + private PercentageScoreHeuristicDescriptor PercentageDescriptor { get; set; } + private Action PercentageDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristic? ScriptHeuristicValue { get; set; } + private ScriptedHeuristicDescriptor ScriptHeuristicDescriptor { get; set; } + private Action ScriptHeuristicDescriptorAction { get; set; } + private long? ShardMinDocCountValue { get; set; } + private int? ShardSizeValue { get; set; } + private int? SizeValue { get; set; } + + public SignificantTermsAggregationDescriptor Aggregations(Elastic.Clients.Elasticsearch.Aggregations.AggregationDictionary? aggregations) + { + AggregationsDescriptor = null; + AggregationsDescriptorAction = null; + AggregationsValue = aggregations; + return Self; + } + + public SignificantTermsAggregationDescriptor Aggregations(Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor descriptor) + { + AggregationsValue = null; + AggregationsDescriptorAction = null; + AggregationsDescriptor = descriptor; + return Self; + } + + public SignificantTermsAggregationDescriptor Aggregations(Action configure) + { + AggregationsValue = null; + AggregationsDescriptor = null; + AggregationsDescriptorAction = configure; + return Self; + } + + public SignificantTermsAggregationDescriptor BackgroundFilter(Elastic.Clients.Elasticsearch.QueryDsl.Query? backgroundFilter) + { + BackgroundFilterDescriptor = null; + BackgroundFilterDescriptorAction = null; + BackgroundFilterValue = backgroundFilter; + return Self; + } + + public SignificantTermsAggregationDescriptor BackgroundFilter(QueryDsl.QueryDescriptor descriptor) + { + BackgroundFilterValue = null; + BackgroundFilterDescriptorAction = null; + BackgroundFilterDescriptor = descriptor; + return Self; + } + + public SignificantTermsAggregationDescriptor BackgroundFilter(Action configure) + { + BackgroundFilterValue = null; + BackgroundFilterDescriptor = null; + BackgroundFilterDescriptorAction = configure; + return Self; + } + + public SignificantTermsAggregationDescriptor ChiSquare(Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristic? chiSquare) + { + ChiSquareDescriptor = null; + ChiSquareDescriptorAction = null; + ChiSquareValue = chiSquare; + return Self; + } + + public SignificantTermsAggregationDescriptor ChiSquare(ChiSquareHeuristicDescriptor descriptor) + { + ChiSquareValue = null; + ChiSquareDescriptorAction = null; + ChiSquareDescriptor = descriptor; + return Self; + } + + public SignificantTermsAggregationDescriptor ChiSquare(Action configure) + { + ChiSquareValue = null; + ChiSquareDescriptor = null; + ChiSquareDescriptorAction = configure; + return Self; + } + + public SignificantTermsAggregationDescriptor Exclude(Elastic.Clients.Elasticsearch.Aggregations.TermsExclude? exclude) + { + ExcludeValue = exclude; + return Self; + } + + public SignificantTermsAggregationDescriptor ExecutionHint(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationExecutionHint? executionHint) + { + ExecutionHintValue = executionHint; + return Self; + } + + public SignificantTermsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + { + FieldValue = field; + return Self; + } + + public SignificantTermsAggregationDescriptor Field(Expression> field) + { + FieldValue = field; + return Self; + } + + public SignificantTermsAggregationDescriptor Field(Expression> field) + { + FieldValue = field; + return Self; + } + + public SignificantTermsAggregationDescriptor Gnd(Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristic? gnd) + { + GndDescriptor = null; + GndDescriptorAction = null; + GndValue = gnd; + return Self; + } + + public SignificantTermsAggregationDescriptor Gnd(GoogleNormalizedDistanceHeuristicDescriptor descriptor) + { + GndValue = null; + GndDescriptorAction = null; + GndDescriptor = descriptor; + return Self; + } + + public SignificantTermsAggregationDescriptor Gnd(Action configure) + { + GndValue = null; + GndDescriptor = null; + GndDescriptorAction = configure; + return Self; + } + + public SignificantTermsAggregationDescriptor Include(Elastic.Clients.Elasticsearch.Aggregations.TermsInclude? include) + { + IncludeValue = include; + return Self; + } + + public SignificantTermsAggregationDescriptor Jlh(Elastic.Clients.Elasticsearch.EmptyObject? jlh) + { + JlhDescriptor = null; + JlhDescriptorAction = null; + JlhValue = jlh; + return Self; + } + + public SignificantTermsAggregationDescriptor Jlh(EmptyObjectDescriptor descriptor) + { + JlhValue = null; + JlhDescriptorAction = null; + JlhDescriptor = descriptor; + return Self; + } + + public SignificantTermsAggregationDescriptor Jlh(Action configure) + { + JlhValue = null; + JlhDescriptor = null; + JlhDescriptorAction = configure; + return Self; + } + + public SignificantTermsAggregationDescriptor Meta(Func, FluentDictionary> selector) + { + MetaValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + public SignificantTermsAggregationDescriptor MinDocCount(long? minDocCount) + { + MinDocCountValue = minDocCount; + return Self; + } + + public SignificantTermsAggregationDescriptor MutualInformation(Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristic? mutualInformation) + { + MutualInformationDescriptor = null; + MutualInformationDescriptorAction = null; + MutualInformationValue = mutualInformation; + return Self; + } + + public SignificantTermsAggregationDescriptor MutualInformation(MutualInformationHeuristicDescriptor descriptor) + { + MutualInformationValue = null; + MutualInformationDescriptorAction = null; + MutualInformationDescriptor = descriptor; + return Self; + } + + public SignificantTermsAggregationDescriptor MutualInformation(Action configure) + { + MutualInformationValue = null; + MutualInformationDescriptor = null; + MutualInformationDescriptorAction = configure; + return Self; + } + + public SignificantTermsAggregationDescriptor Percentage(Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristic? percentage) + { + PercentageDescriptor = null; + PercentageDescriptorAction = null; + PercentageValue = percentage; + return Self; + } + + public SignificantTermsAggregationDescriptor Percentage(PercentageScoreHeuristicDescriptor descriptor) + { + PercentageValue = null; + PercentageDescriptorAction = null; + PercentageDescriptor = descriptor; + return Self; + } + + public SignificantTermsAggregationDescriptor Percentage(Action configure) + { + PercentageValue = null; + PercentageDescriptor = null; + PercentageDescriptorAction = configure; + return Self; + } + + public SignificantTermsAggregationDescriptor ScriptHeuristic(Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristic? scriptHeuristic) + { + ScriptHeuristicDescriptor = null; + ScriptHeuristicDescriptorAction = null; + ScriptHeuristicValue = scriptHeuristic; + return Self; + } + + public SignificantTermsAggregationDescriptor ScriptHeuristic(ScriptedHeuristicDescriptor descriptor) + { + ScriptHeuristicValue = null; + ScriptHeuristicDescriptorAction = null; + ScriptHeuristicDescriptor = descriptor; + return Self; + } + + public SignificantTermsAggregationDescriptor ScriptHeuristic(Action configure) + { + ScriptHeuristicValue = null; + ScriptHeuristicDescriptor = null; + ScriptHeuristicDescriptorAction = configure; + return Self; + } + + public SignificantTermsAggregationDescriptor ShardMinDocCount(long? shardMinDocCount) + { + ShardMinDocCountValue = shardMinDocCount; + return Self; + } + + public SignificantTermsAggregationDescriptor ShardSize(int? shardSize) + { + ShardSizeValue = shardSize; + return Self; + } + + public SignificantTermsAggregationDescriptor Size(int? size) + { + SizeValue = size; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("significant_terms"); + writer.WriteStartObject(); + if (BackgroundFilterDescriptor is not null) + { + writer.WritePropertyName("background_filter"); + JsonSerializer.Serialize(writer, BackgroundFilterDescriptor, options); + } + else if (BackgroundFilterDescriptorAction is not null) + { + writer.WritePropertyName("background_filter"); + JsonSerializer.Serialize(writer, new QueryDsl.QueryDescriptor(BackgroundFilterDescriptorAction), options); + } + else if (BackgroundFilterValue is not null) + { + writer.WritePropertyName("background_filter"); + JsonSerializer.Serialize(writer, BackgroundFilterValue, options); + } + + if (ChiSquareDescriptor is not null) + { + writer.WritePropertyName("chi_square"); + JsonSerializer.Serialize(writer, ChiSquareDescriptor, options); + } + else if (ChiSquareDescriptorAction is not null) + { + writer.WritePropertyName("chi_square"); + JsonSerializer.Serialize(writer, new ChiSquareHeuristicDescriptor(ChiSquareDescriptorAction), options); + } + else if (ChiSquareValue is not null) + { + writer.WritePropertyName("chi_square"); + JsonSerializer.Serialize(writer, ChiSquareValue, options); + } + + if (ExcludeValue is not null) + { + writer.WritePropertyName("exclude"); + JsonSerializer.Serialize(writer, ExcludeValue, options); + } + + if (ExecutionHintValue is not null) + { + writer.WritePropertyName("execution_hint"); + JsonSerializer.Serialize(writer, ExecutionHintValue, options); + } + + if (FieldValue is not null) + { + writer.WritePropertyName("field"); + JsonSerializer.Serialize(writer, FieldValue, options); + } + + if (GndDescriptor is not null) + { + writer.WritePropertyName("gnd"); + JsonSerializer.Serialize(writer, GndDescriptor, options); + } + else if (GndDescriptorAction is not null) + { + writer.WritePropertyName("gnd"); + JsonSerializer.Serialize(writer, new GoogleNormalizedDistanceHeuristicDescriptor(GndDescriptorAction), options); + } + else if (GndValue is not null) + { + writer.WritePropertyName("gnd"); + JsonSerializer.Serialize(writer, GndValue, options); + } + + if (IncludeValue is not null) + { + writer.WritePropertyName("include"); + JsonSerializer.Serialize(writer, IncludeValue, options); + } + + if (JlhDescriptor is not null) + { + writer.WritePropertyName("jlh"); + JsonSerializer.Serialize(writer, JlhDescriptor, options); + } + else if (JlhDescriptorAction is not null) + { + writer.WritePropertyName("jlh"); + JsonSerializer.Serialize(writer, new EmptyObjectDescriptor(JlhDescriptorAction), options); + } + else if (JlhValue is not null) + { + writer.WritePropertyName("jlh"); + JsonSerializer.Serialize(writer, JlhValue, options); + } + + if (MinDocCountValue.HasValue) + { + writer.WritePropertyName("min_doc_count"); + writer.WriteNumberValue(MinDocCountValue.Value); + } + + if (MutualInformationDescriptor is not null) + { + writer.WritePropertyName("mutual_information"); + JsonSerializer.Serialize(writer, MutualInformationDescriptor, options); + } + else if (MutualInformationDescriptorAction is not null) + { + writer.WritePropertyName("mutual_information"); + JsonSerializer.Serialize(writer, new MutualInformationHeuristicDescriptor(MutualInformationDescriptorAction), options); + } + else if (MutualInformationValue is not null) + { + writer.WritePropertyName("mutual_information"); + JsonSerializer.Serialize(writer, MutualInformationValue, options); + } + + if (PercentageDescriptor is not null) + { + writer.WritePropertyName("percentage"); + JsonSerializer.Serialize(writer, PercentageDescriptor, options); + } + else if (PercentageDescriptorAction is not null) + { + writer.WritePropertyName("percentage"); + JsonSerializer.Serialize(writer, new PercentageScoreHeuristicDescriptor(PercentageDescriptorAction), options); + } + else if (PercentageValue is not null) + { + writer.WritePropertyName("percentage"); + JsonSerializer.Serialize(writer, PercentageValue, options); + } + + if (ScriptHeuristicDescriptor is not null) + { + writer.WritePropertyName("script_heuristic"); + JsonSerializer.Serialize(writer, ScriptHeuristicDescriptor, options); + } + else if (ScriptHeuristicDescriptorAction is not null) + { + writer.WritePropertyName("script_heuristic"); + JsonSerializer.Serialize(writer, new ScriptedHeuristicDescriptor(ScriptHeuristicDescriptorAction), options); + } + else if (ScriptHeuristicValue is not null) + { + writer.WritePropertyName("script_heuristic"); + JsonSerializer.Serialize(writer, ScriptHeuristicValue, options); + } + + if (ShardMinDocCountValue.HasValue) + { + writer.WritePropertyName("shard_min_doc_count"); + writer.WriteNumberValue(ShardMinDocCountValue.Value); + } + + if (ShardSizeValue.HasValue) + { + writer.WritePropertyName("shard_size"); + writer.WriteNumberValue(ShardSizeValue.Value); + } + + if (SizeValue.HasValue) + { + writer.WritePropertyName("size"); + writer.WriteNumberValue(SizeValue.Value); + } + + writer.WriteEndObject(); + if (MetaValue is not null) + { + writer.WritePropertyName("meta"); + JsonSerializer.Serialize(writer, MetaValue, options); + } + + if (AggregationsDescriptor is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, AggregationsDescriptor, options); + } + else if (AggregationsDescriptorAction is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, new AggregationDescriptor(AggregationsDescriptorAction), options); + } + else if (AggregationsValue is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, AggregationsValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StringRareTermsAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StringRareTermsAggregate.g.cs new file mode 100644 index 00000000000..c8ffbb7a3d8 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StringRareTermsAggregate.g.cs @@ -0,0 +1,39 @@ +// 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; + +/// +/// Result of the `rare_terms` aggregation when the field is a string. +/// +public sealed partial class StringRareTermsAggregate : IAggregate +{ + [JsonInclude, JsonPropertyName("buckets")] + public IReadOnlyCollection Buckets { get; init; } + [JsonInclude, JsonPropertyName("meta")] + public IReadOnlyDictionary? Meta { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StringRareTermsBucket.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StringRareTermsBucket.g.cs new file mode 100644 index 00000000000..dbe3ddecb92 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StringRareTermsBucket.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. +// +// ------------------------------------------------ + +#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; + +[JsonConverter(typeof(StringRareTermsBucketConverter))] +public sealed partial class StringRareTermsBucket : AggregateDictionary +{ + public StringRareTermsBucket(IReadOnlyDictionary backingDictionary) : base(backingDictionary) + { + } + + [JsonInclude, JsonPropertyName("doc_count")] + public long DocCount { get; init; } + [JsonInclude, JsonPropertyName("key")] + public string Key { get; init; } +} + +internal sealed class StringRareTermsBucketConverter : JsonConverter +{ + public override StringRareTermsBucket? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + throw new JsonException($"Expected {JsonTokenType.StartObject} but read {reader.TokenType}."); + var subAggs = new Dictionary();// TODO - Optimise this and only create if we need it. + long docCount = default; + string key = default; + while (reader.Read()) + { + if (reader.TokenType == JsonTokenType.EndObject) + break; + if (reader.TokenType != JsonTokenType.PropertyName) + throw new JsonException($"Expected {JsonTokenType.PropertyName} but read {reader.TokenType}."); + var name = reader.GetString();// TODO: Future optimisation, get raw bytes span and parse based on those + reader.Read(); + if (name.Equals("doc_count", StringComparison.Ordinal)) + { + docCount = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (name.Equals("key", StringComparison.Ordinal)) + { + key = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (name.Contains("#")) + { + AggregateDictionaryConverter.ReadAggregate(ref reader, options, subAggs, name); + continue; + } + + throw new JsonException("Unknown property read from JSON."); + } + + return new StringRareTermsBucket(subAggs) { DocCount = docCount, Key = key }; + } + + public override void Write(Utf8JsonWriter writer, StringRareTermsBucket value, JsonSerializerOptions options) => throw new NotImplementedException(); +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/WeightedAvgAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/WeightedAverageAggregate.g.cs similarity index 96% rename from src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/WeightedAvgAggregate.g.cs rename to src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/WeightedAverageAggregate.g.cs index 529c9b6b8e6..c3bc446401e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/WeightedAvgAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/WeightedAverageAggregate.g.cs @@ -30,7 +30,7 @@ namespace Elastic.Clients.Elasticsearch.Aggregations; /// /// Weighted average aggregation result. `value` is missing if the weight was set to zero. /// -public sealed partial class WeightedAvgAggregate : IAggregate +public sealed partial class WeightedAverageAggregate : IAggregate { [JsonInclude, JsonPropertyName("meta")] public IReadOnlyDictionary? Meta { get; init; } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/CompletionContext.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/CompletionContext.g.cs index d52290eaa4b..ae908c6b37a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/CompletionContext.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/CompletionContext.g.cs @@ -34,9 +34,9 @@ public sealed partial class CompletionContext [JsonInclude, JsonPropertyName("context")] public Elastic.Clients.Elasticsearch.Core.Search.Context Context { get; set; } [JsonInclude, JsonPropertyName("neighbours")] - public ICollection? Neighbours { get; set; } + public ICollection? Neighbours { get; set; } [JsonInclude, JsonPropertyName("precision")] - public Elastic.Clients.Elasticsearch.GeoHashPrecision? Precision { get; set; } + public Elastic.Clients.Elasticsearch.GeohashPrecision? Precision { get; set; } [JsonInclude, JsonPropertyName("prefix")] public bool? Prefix { get; set; } } @@ -51,8 +51,8 @@ public CompletionContextDescriptor() : base() private double? BoostValue { get; set; } private Elastic.Clients.Elasticsearch.Core.Search.Context ContextValue { get; set; } - private ICollection? NeighboursValue { get; set; } - private Elastic.Clients.Elasticsearch.GeoHashPrecision? PrecisionValue { get; set; } + private ICollection? NeighboursValue { get; set; } + private Elastic.Clients.Elasticsearch.GeohashPrecision? PrecisionValue { get; set; } private bool? PrefixValue { get; set; } public CompletionContextDescriptor Boost(double? boost) @@ -67,13 +67,13 @@ public CompletionContextDescriptor Context(Elastic.Clients.Elasticsearch.Core.Se return Self; } - public CompletionContextDescriptor Neighbours(ICollection? neighbours) + public CompletionContextDescriptor Neighbours(ICollection? neighbours) { NeighboursValue = neighbours; return Self; } - public CompletionContextDescriptor Precision(Elastic.Clients.Elasticsearch.GeoHashPrecision? precision) + public CompletionContextDescriptor Precision(Elastic.Clients.Elasticsearch.GeohashPrecision? precision) { PrecisionValue = precision; return Self; diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/EmptyObject.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/EmptyObject.g.cs new file mode 100644 index 00000000000..0a52b484c77 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/EmptyObject.g.cs @@ -0,0 +1,51 @@ +// 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; + +/// +/// For empty Class assignments +/// +public sealed partial class EmptyObject +{ +} + +/// +/// For empty Class assignments +/// +public sealed partial class EmptyObjectDescriptor : SerializableDescriptor +{ + internal EmptyObjectDescriptor(Action configure) => configure.Invoke(this); + + public EmptyObjectDescriptor() : base() + { + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Aggregations.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Aggregations.g.cs index dd53afc0dfa..22eb8d0a1e2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Aggregations.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Aggregations.g.cs @@ -394,6 +394,54 @@ public override void Write(Utf8JsonWriter writer, RateMode value, JsonSerializer } } +[JsonConverter(typeof(SamplerAggregationExecutionHintConverter))] +public enum SamplerAggregationExecutionHint +{ + [EnumMember(Value = "map")] + Map, + [EnumMember(Value = "global_ordinals")] + GlobalOrdinals, + [EnumMember(Value = "bytes_hash")] + BytesHash +} + +internal sealed class SamplerAggregationExecutionHintConverter : JsonConverter +{ + public override SamplerAggregationExecutionHint Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + var enumString = reader.GetString(); + switch (enumString) + { + case "map": + return SamplerAggregationExecutionHint.Map; + case "global_ordinals": + return SamplerAggregationExecutionHint.GlobalOrdinals; + case "bytes_hash": + return SamplerAggregationExecutionHint.BytesHash; + } + + ThrowHelper.ThrowJsonException(); return default; + } + + public override void Write(Utf8JsonWriter writer, SamplerAggregationExecutionHint value, JsonSerializerOptions options) + { + switch (value) + { + case SamplerAggregationExecutionHint.Map: + writer.WriteStringValue("map"); + return; + case SamplerAggregationExecutionHint.GlobalOrdinals: + writer.WriteStringValue("global_ordinals"); + return; + case SamplerAggregationExecutionHint.BytesHash: + writer.WriteStringValue("bytes_hash"); + return; + } + + writer.WriteNullValue(); + } +} + [JsonConverter(typeof(TermsAggregationCollectModeConverter))] public enum TermsAggregationCollectMode { diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeoHashPrecision.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeohashPrecision.g.cs similarity index 89% rename from src/Elastic.Clients.Elasticsearch/_Generated/Types/GeoHashPrecision.g.cs rename to src/Elastic.Clients.Elasticsearch/_Generated/Types/GeohashPrecision.g.cs index 81cfa3e88be..f511de2038a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeoHashPrecision.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeohashPrecision.g.cs @@ -30,13 +30,13 @@ namespace Elastic.Clients.Elasticsearch; -public sealed partial class GeoHashPrecision : Union +public sealed partial class GeohashPrecision : Union { - public GeoHashPrecision(double geohash_length) : base(geohash_length) + public GeohashPrecision(double geohash_length) : base(geohash_length) { } - public GeoHashPrecision(string distance) : base(distance) + public GeohashPrecision(string distance) : base(distance) { } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/AliasDefinition.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/AliasDefinition.g.cs index a781e33ba01..25ff67dc29c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/AliasDefinition.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/AliasDefinition.g.cs @@ -30,263 +30,15 @@ namespace Elastic.Clients.Elasticsearch.IndexManagement; public sealed partial class AliasDefinition { [JsonInclude, JsonPropertyName("filter")] - public Elastic.Clients.Elasticsearch.QueryDsl.Query? Filter { get; set; } + public Elastic.Clients.Elasticsearch.QueryDsl.Query? Filter { get; init; } [JsonInclude, JsonPropertyName("index_routing")] - public string? IndexRouting { get; set; } + public string? IndexRouting { get; init; } [JsonInclude, JsonPropertyName("is_hidden")] - public bool? IsHidden { get; set; } + public bool? IsHidden { get; init; } [JsonInclude, JsonPropertyName("is_write_index")] - public bool? IsWriteIndex { get; set; } + public bool? IsWriteIndex { get; init; } [JsonInclude, JsonPropertyName("routing")] - public string? Routing { get; set; } + public string? Routing { get; init; } [JsonInclude, JsonPropertyName("search_routing")] - public string? SearchRouting { get; set; } -} - -public sealed partial class AliasDefinitionDescriptor : SerializableDescriptor> -{ - internal AliasDefinitionDescriptor(Action> configure) => configure.Invoke(this); - - public AliasDefinitionDescriptor() : base() - { - } - - private Elastic.Clients.Elasticsearch.QueryDsl.Query? FilterValue { get; set; } - private QueryDsl.QueryDescriptor FilterDescriptor { get; set; } - private Action> FilterDescriptorAction { get; set; } - private string? IndexRoutingValue { get; set; } - private bool? IsHiddenValue { get; set; } - private bool? IsWriteIndexValue { get; set; } - private string? RoutingValue { get; set; } - private string? SearchRoutingValue { get; set; } - - public AliasDefinitionDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? filter) - { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterValue = filter; - return Self; - } - - public AliasDefinitionDescriptor Filter(QueryDsl.QueryDescriptor descriptor) - { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptor = descriptor; - return Self; - } - - public AliasDefinitionDescriptor Filter(Action> configure) - { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = configure; - return Self; - } - - public AliasDefinitionDescriptor IndexRouting(string? indexRouting) - { - IndexRoutingValue = indexRouting; - return Self; - } - - public AliasDefinitionDescriptor IsHidden(bool? isHidden = true) - { - IsHiddenValue = isHidden; - return Self; - } - - public AliasDefinitionDescriptor IsWriteIndex(bool? isWriteIndex = true) - { - IsWriteIndexValue = isWriteIndex; - return Self; - } - - public AliasDefinitionDescriptor Routing(string? routing) - { - RoutingValue = routing; - return Self; - } - - public AliasDefinitionDescriptor SearchRouting(string? searchRouting) - { - SearchRoutingValue = searchRouting; - return Self; - } - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - writer.WriteStartObject(); - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new QueryDsl.QueryDescriptor(FilterDescriptorAction), options); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterValue, options); - } - - if (!string.IsNullOrEmpty(IndexRoutingValue)) - { - writer.WritePropertyName("index_routing"); - writer.WriteStringValue(IndexRoutingValue); - } - - if (IsHiddenValue.HasValue) - { - writer.WritePropertyName("is_hidden"); - writer.WriteBooleanValue(IsHiddenValue.Value); - } - - if (IsWriteIndexValue.HasValue) - { - writer.WritePropertyName("is_write_index"); - writer.WriteBooleanValue(IsWriteIndexValue.Value); - } - - if (!string.IsNullOrEmpty(RoutingValue)) - { - writer.WritePropertyName("routing"); - writer.WriteStringValue(RoutingValue); - } - - if (!string.IsNullOrEmpty(SearchRoutingValue)) - { - writer.WritePropertyName("search_routing"); - writer.WriteStringValue(SearchRoutingValue); - } - - writer.WriteEndObject(); - } -} - -public sealed partial class AliasDefinitionDescriptor : SerializableDescriptor -{ - internal AliasDefinitionDescriptor(Action configure) => configure.Invoke(this); - - public AliasDefinitionDescriptor() : base() - { - } - - private Elastic.Clients.Elasticsearch.QueryDsl.Query? FilterValue { get; set; } - private QueryDsl.QueryDescriptor FilterDescriptor { get; set; } - private Action FilterDescriptorAction { get; set; } - private string? IndexRoutingValue { get; set; } - private bool? IsHiddenValue { get; set; } - private bool? IsWriteIndexValue { get; set; } - private string? RoutingValue { get; set; } - private string? SearchRoutingValue { get; set; } - - public AliasDefinitionDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? filter) - { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterValue = filter; - return Self; - } - - public AliasDefinitionDescriptor Filter(QueryDsl.QueryDescriptor descriptor) - { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptor = descriptor; - return Self; - } - - public AliasDefinitionDescriptor Filter(Action configure) - { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = configure; - return Self; - } - - public AliasDefinitionDescriptor IndexRouting(string? indexRouting) - { - IndexRoutingValue = indexRouting; - return Self; - } - - public AliasDefinitionDescriptor IsHidden(bool? isHidden = true) - { - IsHiddenValue = isHidden; - return Self; - } - - public AliasDefinitionDescriptor IsWriteIndex(bool? isWriteIndex = true) - { - IsWriteIndexValue = isWriteIndex; - return Self; - } - - public AliasDefinitionDescriptor Routing(string? routing) - { - RoutingValue = routing; - return Self; - } - - public AliasDefinitionDescriptor SearchRouting(string? searchRouting) - { - SearchRoutingValue = searchRouting; - return Self; - } - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - writer.WriteStartObject(); - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new QueryDsl.QueryDescriptor(FilterDescriptorAction), options); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterValue, options); - } - - if (!string.IsNullOrEmpty(IndexRoutingValue)) - { - writer.WritePropertyName("index_routing"); - writer.WriteStringValue(IndexRoutingValue); - } - - if (IsHiddenValue.HasValue) - { - writer.WritePropertyName("is_hidden"); - writer.WriteBooleanValue(IsHiddenValue.Value); - } - - if (IsWriteIndexValue.HasValue) - { - writer.WritePropertyName("is_write_index"); - writer.WriteBooleanValue(IsWriteIndexValue.Value); - } - - if (!string.IsNullOrEmpty(RoutingValue)) - { - writer.WritePropertyName("routing"); - writer.WriteStringValue(RoutingValue); - } - - if (!string.IsNullOrEmpty(SearchRoutingValue)) - { - writer.WritePropertyName("search_routing"); - writer.WriteStringValue(SearchRoutingValue); - } - - writer.WriteEndObject(); - } + public string? SearchRouting { get; init; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/PivotGroupBy.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/PivotGroupBy.g.cs index 26731724ae2..aba94236c32 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/PivotGroupBy.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/PivotGroupBy.g.cs @@ -46,6 +46,7 @@ internal PivotGroupBy(string variantName, object variant) internal string VariantName { get; } public static PivotGroupBy DateHistogram(Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregation dateHistogramAggregation) => new PivotGroupBy("date_histogram", dateHistogramAggregation); + public static PivotGroupBy GeotileGrid(Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregation geotileGridAggregation) => new PivotGroupBy("geotile_grid", geotileGridAggregation); public static PivotGroupBy Histogram(Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregation histogramAggregation) => new PivotGroupBy("histogram", histogramAggregation); public static PivotGroupBy Terms(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation termsAggregation) => new PivotGroupBy("terms", termsAggregation); } @@ -74,6 +75,13 @@ public override PivotGroupBy Read(ref Utf8JsonReader reader, Type typeToConvert, return new PivotGroupBy(propertyName, variant); } + if (propertyName == "geotile_grid") + { + var variant = JsonSerializer.Deserialize(ref reader, options); + reader.Read(); + return new PivotGroupBy(propertyName, variant); + } + if (propertyName == "histogram") { var variant = JsonSerializer.Deserialize(ref reader, options); @@ -102,6 +110,9 @@ public override void Write(Utf8JsonWriter writer, PivotGroupBy value, JsonSerial case "date_histogram": JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregation)value.Variant, options); break; + case "geotile_grid": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregation)value.Variant, options); + break; case "histogram": JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregation)value.Variant, options); break; @@ -148,6 +159,8 @@ private PivotGroupByDescriptor Set(object variant, string variantName public PivotGroupByDescriptor DateHistogram(Aggregations.DateHistogramAggregation dateHistogramAggregation) => Set(dateHistogramAggregation, "date_histogram"); public PivotGroupByDescriptor DateHistogram(Action> configure) => Set(configure, "date_histogram"); + public PivotGroupByDescriptor GeotileGrid(Aggregations.GeotileGridAggregation geotileGridAggregation) => Set(geotileGridAggregation, "geotile_grid"); + public PivotGroupByDescriptor GeotileGrid(Action> configure) => Set(configure, "geotile_grid"); public PivotGroupByDescriptor Histogram(Aggregations.HistogramAggregation histogramAggregation) => Set(histogramAggregation, "histogram"); public PivotGroupByDescriptor Histogram(Action> configure) => Set(configure, "histogram"); public PivotGroupByDescriptor Terms(Aggregations.TermsAggregation termsAggregation) => Set(termsAggregation, "terms"); @@ -209,6 +222,9 @@ private PivotGroupByDescriptor Set(object variant, string variantName) public PivotGroupByDescriptor DateHistogram(Aggregations.DateHistogramAggregation dateHistogramAggregation) => Set(dateHistogramAggregation, "date_histogram"); public PivotGroupByDescriptor DateHistogram(Action configure) => Set(configure, "date_histogram"); public PivotGroupByDescriptor DateHistogram(Action> configure) => Set(configure, "date_histogram"); + public PivotGroupByDescriptor GeotileGrid(Aggregations.GeotileGridAggregation geotileGridAggregation) => Set(geotileGridAggregation, "geotile_grid"); + public PivotGroupByDescriptor GeotileGrid(Action configure) => Set(configure, "geotile_grid"); + public PivotGroupByDescriptor GeotileGrid(Action> configure) => Set(configure, "geotile_grid"); public PivotGroupByDescriptor Histogram(Aggregations.HistogramAggregation histogramAggregation) => Set(histogramAggregation, "histogram"); public PivotGroupByDescriptor Histogram(Action configure) => Set(configure, "histogram"); public PivotGroupByDescriptor Histogram(Action> configure) => Set(configure, "histogram"); diff --git a/tests/Tests.Core/ManagedElasticsearch/NodeSeeders/DefaultSeeder.cs b/tests/Tests.Core/ManagedElasticsearch/NodeSeeders/DefaultSeeder.cs index cf0e5e2c364..7b299ac2de8 100644 --- a/tests/Tests.Core/ManagedElasticsearch/NodeSeeders/DefaultSeeder.cs +++ b/tests/Tests.Core/ManagedElasticsearch/NodeSeeders/DefaultSeeder.cs @@ -249,6 +249,7 @@ public async Task CreateIndicesAsync() properties = new Dictionary { + { "leadDeveloper", new { type = "object", properties = new Dictionary { { "ipAddress", new { type = "ip" } } } } }, { "locationPoint", new { type = "geo_point" } }, { "name", new { type = "keyword", store = true, fields = new { suggest = new { type = "completion" }, standard = new { analyzer = "standard", type = "text" } } } }, { "numberOfCommits", new { type = "integer", store = true } }, diff --git a/tests/Tests.Domain/Developer.cs b/tests/Tests.Domain/Developer.cs index 4cdd7001dee..5eaba138a0b 100644 --- a/tests/Tests.Domain/Developer.cs +++ b/tests/Tests.Domain/Developer.cs @@ -16,6 +16,7 @@ public class Developer : Person // not populated by generator. Used by ingest geoip test //public GeoIp GeoIp { get; set; } + public string IpAddress { get; set; } public string OnlineHandle { get; set; } diff --git a/tests/Tests/Aggregations/Bucket/GeoDistanceAggregationUsageTests.cs b/tests/Tests/Aggregations/Bucket/GeoDistanceAggregationUsageTests.cs new file mode 100644 index 00000000000..d7459c8018f --- /dev/null +++ b/tests/Tests/Aggregations/Bucket/GeoDistanceAggregationUsageTests.cs @@ -0,0 +1,55 @@ +// 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; +using Elastic.Clients.Elasticsearch.Aggregations; +using Tests.Core.ManagedElasticsearch.Clusters; +using Tests.Domain; +using Tests.Core.Extensions; +using Tests.Framework.EndpointTests.TestState; +using System.Collections.Generic; +using System.Linq; + +namespace Tests.Aggregations.Bucket; + +public class GeoDistanceAggregationUsageTests : AggregationUsageWithVerifyTestBase +{ + public GeoDistanceAggregationUsageTests(ReadOnlyCluster cluster, EndpointUsage usage) : base(cluster, usage) { } + + protected override Action> FluentAggregations => a => a + .GeoDistance("rings_around_amsterdam", g => g + .Field(p => p.LocationPoint) + .Origin(GeoLocation.LatitudeLongitude(new LatLonGeoLocation { Lat = 52.376, Lon = 4.894 })) + .Ranges( + r => r.To(100), + r => r.From(100).To(300), + r => r.From(300) + ) + ); + + protected override AggregationDictionary InitializerAggregations => + new GeoDistanceAggregation("rings_around_amsterdam") + { + Field = Infer.Field((Project p) => p.LocationPoint), + Origin = "52.376, 4.894", + Ranges = new List + { + new AggregationRange { To = 100 }, + new AggregationRange { From = 100, To = 300 }, + new AggregationRange { From = 300 } + } + }; + + protected override void ExpectResponse(SearchResponse response) + { + response.ShouldBeValid(); + response.Aggregations.Count.Should().Be(1); + + var ringsAroundAmsterdam = response.Aggregations.GetGeoDistance("rings_around_amsterdam"); + ringsAroundAmsterdam.Should().NotBeNull(); + ringsAroundAmsterdam.Buckets.FirstOrDefault(r => r.Key == "*-100.0").Should().NotBeNull(); + ringsAroundAmsterdam.Buckets.FirstOrDefault(r => r.Key == "100.0-300.0").Should().NotBeNull(); + ringsAroundAmsterdam.Buckets.FirstOrDefault(r => r.Key == "300.0-*").Should().NotBeNull(); + } +} diff --git a/tests/Tests/Aggregations/Bucket/GeohashGridAggregationUsageTests.cs b/tests/Tests/Aggregations/Bucket/GeohashGridAggregationUsageTests.cs new file mode 100644 index 00000000000..02a4c491bcf --- /dev/null +++ b/tests/Tests/Aggregations/Bucket/GeohashGridAggregationUsageTests.cs @@ -0,0 +1,48 @@ +// 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; +using Elastic.Clients.Elasticsearch.Aggregations; +using Tests.Core.ManagedElasticsearch.Clusters; +using Tests.Domain; +using Tests.Core.Extensions; +using Tests.Framework.EndpointTests.TestState; +using System.Linq; + +namespace Tests.Aggregations.Bucket; + +public class GeohashGridAggregationUsageTests : AggregationUsageWithVerifyTestBase +{ + public GeohashGridAggregationUsageTests(ReadOnlyCluster cluster, EndpointUsage usage) : base(cluster, usage) { } + + protected override Action> FluentAggregations => a => a + .GeohashGrid("my_geohash_grid", g => g + .Field(p => p.LocationPoint) + .Precision(new GeohashPrecision(3)) + .Size(1000) + .ShardSize(100) + ); + + protected override AggregationDictionary InitializerAggregations => + new GeohashGridAggregation("my_geohash_grid") + { + Field = Infer.Field(p => p.LocationPoint), + Precision = new GeohashPrecision(3), + Size = 1000, + ShardSize = 100 + }; + + protected override void ExpectResponse(SearchResponse response) + { + response.ShouldBeValid(); + response.Aggregations.Count.Should().Be(1); + + var geohashGrid = response.Aggregations.GetGeohashGrid("my_geohash_grid"); + + geohashGrid.Should().NotBeNull(); + var firstBucket = geohashGrid.Buckets.First(); + firstBucket.Key.Should().NotBeNullOrWhiteSpace(); + firstBucket.DocCount.Should().BeGreaterThan(0); + } +} diff --git a/tests/Tests/Aggregations/Bucket/GeotileGridAggregationUsageTests.cs b/tests/Tests/Aggregations/Bucket/GeotileGridAggregationUsageTests.cs new file mode 100644 index 00000000000..905ea105178 --- /dev/null +++ b/tests/Tests/Aggregations/Bucket/GeotileGridAggregationUsageTests.cs @@ -0,0 +1,48 @@ +// 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; +using Elastic.Clients.Elasticsearch.Aggregations; +using Tests.Core.ManagedElasticsearch.Clusters; +using Tests.Domain; +using Tests.Core.Extensions; +using Tests.Framework.EndpointTests.TestState; +using System.Linq; + +namespace Tests.Aggregations.Bucket; + +public class GeotileGridAggregationUsageTests : AggregationUsageWithVerifyTestBase +{ + public GeotileGridAggregationUsageTests(ReadOnlyCluster cluster, EndpointUsage usage) : base(cluster, usage) { } + + protected override Action> FluentAggregations => a => a + .GeotileGrid("my_geotile", g => g + .Field(p => p.LocationPoint) + .Precision(3) + .Size(1000) + .ShardSize(100) + ); + + protected override AggregationDictionary InitializerAggregations => + new GeotileGridAggregation("my_geotile") + { + Field = Infer.Field(p => p.LocationPoint), + Precision = 3, + Size = 1000, + ShardSize = 100 + }; + + protected override void ExpectResponse(SearchResponse response) + { + response.ShouldBeValid(); + response.Aggregations.Count.Should().Be(1); + + var myGeoTileGrid = response.Aggregations.GetGeotileGrid("my_geotile"); + + myGeoTileGrid.Should().NotBeNull(); + var firstBucket = myGeoTileGrid.Buckets.First(); + firstBucket.Key.Should().NotBeNullOrWhiteSpace(); + firstBucket.DocCount.Should().BeGreaterThan(0); + } +} diff --git a/tests/Tests/Aggregations/Bucket/IpPrefixAggregationUsageTests.cs b/tests/Tests/Aggregations/Bucket/IpPrefixAggregationUsageTests.cs new file mode 100644 index 00000000000..113e0a35516 --- /dev/null +++ b/tests/Tests/Aggregations/Bucket/IpPrefixAggregationUsageTests.cs @@ -0,0 +1,60 @@ +// 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; +using Elastic.Clients.Elasticsearch.Aggregations; +using Tests.Core.ManagedElasticsearch.Clusters; +using Tests.Domain; +using Tests.Core.Extensions; +using Tests.Framework.EndpointTests.TestState; +using System.Collections.Generic; + +namespace Tests.Aggregations.Bucket; + +[SkipVersion("<8.1.0", "IP prefix aggregations were introduced in 8.1.0")] +public class IpPrefixAggregationUsageTests : AggregationUsageWithVerifyTestBase +{ + public IpPrefixAggregationUsageTests(ReadOnlyCluster cluster, EndpointUsage usage) : base(cluster, usage) { } + + protected override Action> FluentAggregations => a => a + .IpPrefix("ipv4-subnets", i => i + .Field(f => f.LeadDeveloper.IpAddress) + .PrefixLength(24) + .Meta(m => m + .Add("foo", "bar") + )); + + protected override AggregationDictionary InitializerAggregations => + new IpPrefixAggregation("ipv4-subnets") + { + Field = Infer.Field((Project p) => p.LeadDeveloper.IpAddress), + PrefixLength = 24, + Meta = new Dictionary + { + { "foo", "bar" } + } + }; + + protected override void ExpectResponse(SearchResponse response) + { + response.ShouldBeValid(); + response.Aggregations.Count.Should().Be(1); + + var ipPrefix = response.Aggregations.GetIpPrefix("ipv4-subnets"); + + ipPrefix.Should().NotBeNull(); + ipPrefix.Buckets.Should().NotBeNull(); + ipPrefix.Buckets.Count.Should().BeGreaterThan(0); + foreach (var item in ipPrefix.Buckets) + { + item.Key.Should().NotBeNullOrEmpty(); + item.DocCount.Should().BeGreaterOrEqualTo(1); + item.PrefixLength.Should().Be(24); + item.Netmask.Should().Be("255.255.255.0"); + item.IsIpv6.Should().BeFalse(); + } + ipPrefix.Meta.Should().NotBeNull().And.HaveCount(1); + ipPrefix.Meta["foo"].Should().Be("bar"); + } +} diff --git a/tests/Tests/Aggregations/Bucket/MultiTermsAggregationUsageTests.cs b/tests/Tests/Aggregations/Bucket/MultiTermsAggregationUsageTests.cs new file mode 100644 index 00000000000..234814fad68 --- /dev/null +++ b/tests/Tests/Aggregations/Bucket/MultiTermsAggregationUsageTests.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. + +using System.Collections.Generic; +using System; +using Tests.Core.ManagedElasticsearch.Clusters; +using Tests.Domain; +using Tests.Framework.EndpointTests.TestState; +using Elastic.Clients.Elasticsearch.Aggregations; +using Tests.Core.Extensions; + +namespace Tests.Aggregations.Bucket; + +public class MultiTermsAggregationUsageTests : AggregationUsageWithVerifyTestBase +{ + public MultiTermsAggregationUsageTests(ReadOnlyCluster cluster, EndpointUsage usage) : base(cluster, usage) { } + + protected override Action> FluentAggregations => a => a + .MultiTerms("states", st => st + .CollectMode(TermsAggregationCollectMode.BreadthFirst) + .Terms( + t => t.Field(f => f.Name), + t => t.Field(f => f.NumberOfCommits).Missing(0)) + .MinDocCount(1) + .Size(5) + .ShardSize(100) + .ShardMinDocCount(1) + .ShowTermDocCountError(true) + .Order(new [] + { + new KeyValuePair("_key", SortOrder.Asc), + new KeyValuePair("_count", SortOrder.Desc) + }) + .Meta(m => m + .Add("foo", "bar") + ) + ); + + protected override AggregationDictionary InitializerAggregations => + new MultiTermsAggregation("states") + { + CollectMode = TermsAggregationCollectMode.BreadthFirst, + Terms = new List + { + new() { Field = Infer.Field(f => f.Name) }, + new() { Field = Infer.Field(f => f.NumberOfCommits), Missing = 0 } + }, + MinDocCount = 1, + Size = 5, + ShardSize = 100, + ShardMinDocCount = 1, + ShowTermDocCountError = true, + Order = new[] + { + new KeyValuePair("_key", SortOrder.Asc), + new KeyValuePair("_count", SortOrder.Desc) + }, + Meta = new Dictionary + { + { "foo", "bar" } + } + }; + + protected override void ExpectResponse(SearchResponse response) + { + response.ShouldBeValid(); + + var states = response.Aggregations.GetMultiTerms("states"); + + states.Should().NotBeNull(); + states.DocCountErrorUpperBound.Should().HaveValue(); + states.SumOtherDocCount.Should().HaveValue(); + states.Buckets.Should().NotBeNull(); + states.Buckets.Count.Should().BeGreaterThan(0); + foreach (var item in states.Buckets) + { + item.Key.Should().NotBeNullOrEmpty(); + item.DocCount.Should().BeGreaterOrEqualTo(1); + item.KeyAsString.Should().NotBeNullOrEmpty(); + } + states.Meta.Should().NotBeNull().And.HaveCount(1); + states.Meta["foo"].Should().Be("bar"); + } +} diff --git a/tests/Tests/Aggregations/Bucket/RareTermsAggregationUsageTests.cs b/tests/Tests/Aggregations/Bucket/RareTermsAggregationUsageTests.cs new file mode 100644 index 00000000000..9a1adbc44cc --- /dev/null +++ b/tests/Tests/Aggregations/Bucket/RareTermsAggregationUsageTests.cs @@ -0,0 +1,61 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; +using System; +using Tests.Core.ManagedElasticsearch.Clusters; +using Tests.Domain; +using Tests.Framework.EndpointTests.TestState; +using Elastic.Clients.Elasticsearch.Aggregations; +using Tests.Core.Extensions; + +namespace Tests.Aggregations.Bucket; + +public class RareTermsAggregationUsageTests : AggregationUsageWithVerifyTestBase +{ + public RareTermsAggregationUsageTests(ReadOnlyCluster cluster, EndpointUsage usage) : base(cluster, usage) { } + + protected override bool CompareJsonStrings => true; + + protected override Action> FluentAggregations => a => a + .RareTerms("names", st => st + .Field(p => p.Name) + .Missing("n/a") + .MaxDocCount(5) + .Precision(0.001) + .Meta(m => m + .Add("foo", "bar") + ) + ); + + protected override AggregationDictionary InitializerAggregations => + new RareTermsAggregation("names") + { + Field = Infer.Field(p => p.Name), + MaxDocCount = 5, + Precision = 0.001, + Missing = "n/a", + Meta = new Dictionary { { "foo", "bar" } } + }; + + protected override void ExpectResponse(SearchResponse response) + { + response.ShouldBeValid(); + + var rareTerms = response.Aggregations.GetStringRareTerms("names"); + + rareTerms.Should().NotBeNull(); + rareTerms.Buckets.Should().NotBeNull(); + rareTerms.Buckets.Count.Should().BeGreaterThan(0); + + foreach (var item in rareTerms.Buckets) + { + item.Key.Should().NotBeNullOrEmpty(); + item.DocCount.Should().BeGreaterOrEqualTo(1); + } + + rareTerms.Meta.Should().NotBeNull().And.HaveCount(1); + rareTerms.Meta["foo"].Should().Be("bar"); + } +} diff --git a/tests/Tests/Aggregations/Bucket/SignificantTermsAggregationUsageTests.cs b/tests/Tests/Aggregations/Bucket/SignificantTermsAggregationUsageTests.cs new file mode 100644 index 00000000000..c17249e088d --- /dev/null +++ b/tests/Tests/Aggregations/Bucket/SignificantTermsAggregationUsageTests.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; +using Elastic.Clients.Elasticsearch.Aggregations; +using Tests.Core.ManagedElasticsearch.Clusters; +using Tests.Domain; +using Tests.Core.Extensions; +using Tests.Framework.EndpointTests.TestState; + +namespace Tests.Aggregations.Bucket; + +public class SignificantTermsAggregationUsageTests : AggregationUsageWithVerifyTestBase +{ + public SignificantTermsAggregationUsageTests(ReadOnlyCluster cluster, EndpointUsage usage) : base(cluster, usage) { } + + protected override Action> FluentAggregations => a => a + .SignificantTerms("significant_names", st => st + .Field(p => p.Name) + .MinDocCount(10) + .MutualInformation(mi => mi + .BackgroundIsSuperset() + .IncludeNegatives() + ) + ); + + protected override AggregationDictionary InitializerAggregations => + new SignificantTermsAggregation("significant_names") + { + Field = Infer.Field(p => p.Name), + MinDocCount = 10, + MutualInformation = new MutualInformationHeuristic + { + BackgroundIsSuperset = true, + IncludeNegatives = true + } + }; + + protected override void ExpectResponse(SearchResponse response) + { + response.ShouldBeValid(); + response.Aggregations.Count.Should().Be(1); + + var sigNames = response.Aggregations.GetSignificantStringTerms("significant_names"); + + sigNames.Should().NotBeNull(); + sigNames.DocCount.Should().BeGreaterThan(0); + } +} diff --git a/tests/Tests/Aggregations/Metric/BoxplotAggregationUsageTests.cs b/tests/Tests/Aggregations/Metric/BoxplotAggregationUsageTests.cs index ecf84725448..fd37d55f2f8 100644 --- a/tests/Tests/Aggregations/Metric/BoxplotAggregationUsageTests.cs +++ b/tests/Tests/Aggregations/Metric/BoxplotAggregationUsageTests.cs @@ -60,7 +60,7 @@ public BoxplotAggregationUsageTests(ReadOnlyCluster i, EndpointUsage usage) : ba protected override void ExpectResponse(SearchResponse response) { response.ShouldBeValid(); - var boxplot = response.Aggregations.GetBoxPlot("boxplot_commits"); + var boxplot = response.Aggregations.GetBoxplot("boxplot_commits"); boxplot.Should().NotBeNull(); boxplot.Min.Should().BeGreaterOrEqualTo(0); boxplot.Max.Should().BeGreaterOrEqualTo(0); diff --git a/tests/Tests/Aggregations/Metric/WeightedAverageAggregationUsageTests.cs b/tests/Tests/Aggregations/Metric/WeightedAverageAggregationUsageTests.cs index 983a7c5820e..8752abc5fd4 100644 --- a/tests/Tests/Aggregations/Metric/WeightedAverageAggregationUsageTests.cs +++ b/tests/Tests/Aggregations/Metric/WeightedAverageAggregationUsageTests.cs @@ -45,7 +45,6 @@ public WeightedAverageAggregationUsageTests(ReadOnlyCluster i, EndpointUsage usa protected override Action> FluentAggs => a => a .WeightedAvg("weighted_avg_commits", avg => avg .Value(v => v.Field(p => p.NumberOfCommits).Missing(0)) - //.Weight(w => w.Script("(doc['numberOfContributors']?.value ?: 0) + 1")) .Weight(s => s.Script(new Script(new InlineScript("(doc['numberOfContributors']?.value ?: 0) + 1")))) .ValueType(Elastic.Clients.Elasticsearch.Aggregations.ValueType.Long) ); @@ -68,7 +67,7 @@ public WeightedAverageAggregationUsageTests(ReadOnlyCluster i, EndpointUsage usa protected override void ExpectResponse(SearchResponse response) { response.ShouldBeValid(); - var commitsAvg = response.Aggregations.GetWeightedAvg("weighted_avg_commits"); + var commitsAvg = response.Aggregations.GetWeightedAverage("weighted_avg_commits"); commitsAvg.Should().NotBeNull(); commitsAvg.Value.Should().BeGreaterThan(0); } diff --git a/tests/Tests/Serialization/Aggregations/BoxplotAggregateDeserializationTests.cs b/tests/Tests/Serialization/Aggregations/BoxplotAggregateDeserializationTests.cs index a6ce04e0afe..6429c4b2168 100644 --- a/tests/Tests/Serialization/Aggregations/BoxplotAggregateDeserializationTests.cs +++ b/tests/Tests/Serialization/Aggregations/BoxplotAggregateDeserializationTests.cs @@ -18,7 +18,7 @@ public void CanDeserializeAggregate() search.Aggregations.Should().HaveCount(1); - var agg = search.Aggregations.GetBoxPlot("my-agg-name"); + var agg = search.Aggregations.GetBoxplot("my-agg-name"); agg.Min.Should().Be(1); agg.Max.Should().Be(990); agg.Q1.Should().Be(165); diff --git a/tests/Tests/_VerifySnapshots/GeoDistanceAggregationUsageTests.VerifyDescriptorJson.verified.txt b/tests/Tests/_VerifySnapshots/GeoDistanceAggregationUsageTests.VerifyDescriptorJson.verified.txt new file mode 100644 index 00000000000..6e2f3159ccd --- /dev/null +++ b/tests/Tests/_VerifySnapshots/GeoDistanceAggregationUsageTests.VerifyDescriptorJson.verified.txt @@ -0,0 +1,33 @@ +{ + aggregations: { + rings_around_amsterdam: { + geo_distance: { + field: locationPoint, + origin: { + lat: 52.376, + lon: 4.894 + }, + ranges: [ + { + to: 100 + }, + { + from: 100, + to: 300 + }, + { + from: 300 + } + ] + } + } + }, + query: { + term: { + type: { + value: project + } + } + }, + size: 0 +} \ No newline at end of file diff --git a/tests/Tests/_VerifySnapshots/GeoDistanceAggregationUsageTests.VerifyInitializerJson.verified.txt b/tests/Tests/_VerifySnapshots/GeoDistanceAggregationUsageTests.VerifyInitializerJson.verified.txt new file mode 100644 index 00000000000..c3846029512 --- /dev/null +++ b/tests/Tests/_VerifySnapshots/GeoDistanceAggregationUsageTests.VerifyInitializerJson.verified.txt @@ -0,0 +1,30 @@ +{ + aggregations: { + rings_around_amsterdam: { + geo_distance: { + field: locationPoint, + origin: 52.376, 4.894, + ranges: [ + { + to: 100 + }, + { + from: 100, + to: 300 + }, + { + from: 300 + } + ] + } + } + }, + query: { + term: { + type: { + value: project + } + } + }, + size: 0 +} \ No newline at end of file diff --git a/tests/Tests/_VerifySnapshots/GeohashGridAggregationUsageTests.VerifyDescriptorJson.verified.txt b/tests/Tests/_VerifySnapshots/GeohashGridAggregationUsageTests.VerifyDescriptorJson.verified.txt new file mode 100644 index 00000000000..ff6df1c344c --- /dev/null +++ b/tests/Tests/_VerifySnapshots/GeohashGridAggregationUsageTests.VerifyDescriptorJson.verified.txt @@ -0,0 +1,20 @@ +{ + aggregations: { + my_geohash_grid: { + geohash_grid: { + field: locationPoint, + precision: 3, + shard_size: 100, + size: 1000 + } + } + }, + query: { + term: { + type: { + value: project + } + } + }, + size: 0 +} \ No newline at end of file diff --git a/tests/Tests/_VerifySnapshots/GeohashGridAggregationUsageTests.VerifyInitializerJson.verified.txt b/tests/Tests/_VerifySnapshots/GeohashGridAggregationUsageTests.VerifyInitializerJson.verified.txt new file mode 100644 index 00000000000..ff6df1c344c --- /dev/null +++ b/tests/Tests/_VerifySnapshots/GeohashGridAggregationUsageTests.VerifyInitializerJson.verified.txt @@ -0,0 +1,20 @@ +{ + aggregations: { + my_geohash_grid: { + geohash_grid: { + field: locationPoint, + precision: 3, + shard_size: 100, + size: 1000 + } + } + }, + query: { + term: { + type: { + value: project + } + } + }, + size: 0 +} \ No newline at end of file diff --git a/tests/Tests/_VerifySnapshots/GeotileGridAggregationUsageTests.VerifyDescriptorJson.verified.txt b/tests/Tests/_VerifySnapshots/GeotileGridAggregationUsageTests.VerifyDescriptorJson.verified.txt new file mode 100644 index 00000000000..047279bf9ab --- /dev/null +++ b/tests/Tests/_VerifySnapshots/GeotileGridAggregationUsageTests.VerifyDescriptorJson.verified.txt @@ -0,0 +1,20 @@ +{ + aggregations: { + my_geotile: { + geotile_grid: { + field: locationPoint, + precision: 3, + shard_size: 100, + size: 1000 + } + } + }, + query: { + term: { + type: { + value: project + } + } + }, + size: 0 +} \ No newline at end of file diff --git a/tests/Tests/_VerifySnapshots/GeotileGridAggregationUsageTests.VerifyInitializerJson.verified.txt b/tests/Tests/_VerifySnapshots/GeotileGridAggregationUsageTests.VerifyInitializerJson.verified.txt new file mode 100644 index 00000000000..047279bf9ab --- /dev/null +++ b/tests/Tests/_VerifySnapshots/GeotileGridAggregationUsageTests.VerifyInitializerJson.verified.txt @@ -0,0 +1,20 @@ +{ + aggregations: { + my_geotile: { + geotile_grid: { + field: locationPoint, + precision: 3, + shard_size: 100, + size: 1000 + } + } + }, + query: { + term: { + type: { + value: project + } + } + }, + size: 0 +} \ No newline at end of file diff --git a/tests/Tests/_VerifySnapshots/IpPrefixAggregationUsageTests.VerifyDescriptorJson.verified.txt b/tests/Tests/_VerifySnapshots/IpPrefixAggregationUsageTests.VerifyDescriptorJson.verified.txt new file mode 100644 index 00000000000..f6cac254fc7 --- /dev/null +++ b/tests/Tests/_VerifySnapshots/IpPrefixAggregationUsageTests.VerifyDescriptorJson.verified.txt @@ -0,0 +1,21 @@ +{ + aggregations: { + ipv4-subnets: { + ip_prefix: { + field: leadDeveloper.ipAddress, + prefix_length: 24 + }, + meta: { + foo: bar + } + } + }, + query: { + term: { + type: { + value: project + } + } + }, + size: 0 +} \ No newline at end of file diff --git a/tests/Tests/_VerifySnapshots/IpPrefixAggregationUsageTests.VerifyInitializerJson.verified.txt b/tests/Tests/_VerifySnapshots/IpPrefixAggregationUsageTests.VerifyInitializerJson.verified.txt new file mode 100644 index 00000000000..f6cac254fc7 --- /dev/null +++ b/tests/Tests/_VerifySnapshots/IpPrefixAggregationUsageTests.VerifyInitializerJson.verified.txt @@ -0,0 +1,21 @@ +{ + aggregations: { + ipv4-subnets: { + ip_prefix: { + field: leadDeveloper.ipAddress, + prefix_length: 24 + }, + meta: { + foo: bar + } + } + }, + query: { + term: { + type: { + value: project + } + } + }, + size: 0 +} \ No newline at end of file diff --git a/tests/Tests/_VerifySnapshots/MultiTermsAggregationUsageTests.VerifyDescriptorJson.verified.txt b/tests/Tests/_VerifySnapshots/MultiTermsAggregationUsageTests.VerifyDescriptorJson.verified.txt new file mode 100644 index 00000000000..35ba111038d --- /dev/null +++ b/tests/Tests/_VerifySnapshots/MultiTermsAggregationUsageTests.VerifyDescriptorJson.verified.txt @@ -0,0 +1,42 @@ +{ + aggregations: { + states: { + meta: { + foo: bar + }, + multi_terms: { + collect_mode: breadth_first, + min_doc_count: 1, + order: [ + { + _key: asc + }, + { + _count: desc + } + ], + shard_min_doc_count: 1, + shard_size: 100, + show_term_doc_count_error: true, + size: 5, + terms: [ + { + field: name + }, + { + field: numberOfCommits, + missing: 0 + } + ] + } + } + }, + query: { + term: { + type: { + value: project + } + } + }, + size: 0 +} \ No newline at end of file diff --git a/tests/Tests/_VerifySnapshots/MultiTermsAggregationUsageTests.VerifyInitializerJson.verified.txt b/tests/Tests/_VerifySnapshots/MultiTermsAggregationUsageTests.VerifyInitializerJson.verified.txt new file mode 100644 index 00000000000..35ba111038d --- /dev/null +++ b/tests/Tests/_VerifySnapshots/MultiTermsAggregationUsageTests.VerifyInitializerJson.verified.txt @@ -0,0 +1,42 @@ +{ + aggregations: { + states: { + meta: { + foo: bar + }, + multi_terms: { + collect_mode: breadth_first, + min_doc_count: 1, + order: [ + { + _key: asc + }, + { + _count: desc + } + ], + shard_min_doc_count: 1, + shard_size: 100, + show_term_doc_count_error: true, + size: 5, + terms: [ + { + field: name + }, + { + field: numberOfCommits, + missing: 0 + } + ] + } + } + }, + query: { + term: { + type: { + value: project + } + } + }, + size: 0 +} \ No newline at end of file diff --git a/tests/Tests/_VerifySnapshots/RareTermsAggregationUsageTests.VerifyDescriptorJson.verified.txt b/tests/Tests/_VerifySnapshots/RareTermsAggregationUsageTests.VerifyDescriptorJson.verified.txt new file mode 100644 index 00000000000..e7e32f4b5c5 --- /dev/null +++ b/tests/Tests/_VerifySnapshots/RareTermsAggregationUsageTests.VerifyDescriptorJson.verified.txt @@ -0,0 +1,23 @@ +{ + aggregations: { + names: { + meta: { + foo: bar + }, + rare_terms: { + field: name, + max_doc_count: 5, + missing: n/a, + precision: 0.001 + } + } + }, + query: { + term: { + type: { + value: project + } + } + }, + size: 0 +} \ No newline at end of file diff --git a/tests/Tests/_VerifySnapshots/RareTermsAggregationUsageTests.VerifyInitializerJson.verified.txt b/tests/Tests/_VerifySnapshots/RareTermsAggregationUsageTests.VerifyInitializerJson.verified.txt new file mode 100644 index 00000000000..e7e32f4b5c5 --- /dev/null +++ b/tests/Tests/_VerifySnapshots/RareTermsAggregationUsageTests.VerifyInitializerJson.verified.txt @@ -0,0 +1,23 @@ +{ + aggregations: { + names: { + meta: { + foo: bar + }, + rare_terms: { + field: name, + max_doc_count: 5, + missing: n/a, + precision: 0.001 + } + } + }, + query: { + term: { + type: { + value: project + } + } + }, + size: 0 +} \ No newline at end of file diff --git a/tests/Tests/_VerifySnapshots/SignificantTermsAggregationUsageTests.VerifyDescriptorJson.verified.txt b/tests/Tests/_VerifySnapshots/SignificantTermsAggregationUsageTests.VerifyDescriptorJson.verified.txt new file mode 100644 index 00000000000..79d117c5b3b --- /dev/null +++ b/tests/Tests/_VerifySnapshots/SignificantTermsAggregationUsageTests.VerifyDescriptorJson.verified.txt @@ -0,0 +1,22 @@ +{ + aggregations: { + significant_names: { + significant_terms: { + field: name, + min_doc_count: 10, + mutual_information: { + background_is_superset: true, + include_negatives: true + } + } + } + }, + query: { + term: { + type: { + value: project + } + } + }, + size: 0 +} \ No newline at end of file diff --git a/tests/Tests/_VerifySnapshots/SignificantTermsAggregationUsageTests.VerifyInitializerJson.verified.txt b/tests/Tests/_VerifySnapshots/SignificantTermsAggregationUsageTests.VerifyInitializerJson.verified.txt new file mode 100644 index 00000000000..79d117c5b3b --- /dev/null +++ b/tests/Tests/_VerifySnapshots/SignificantTermsAggregationUsageTests.VerifyInitializerJson.verified.txt @@ -0,0 +1,22 @@ +{ + aggregations: { + significant_names: { + significant_terms: { + field: name, + min_doc_count: 10, + mutual_information: { + background_is_superset: true, + include_negatives: true + } + } + } + }, + query: { + term: { + type: { + value: project + } + } + }, + size: 0 +} \ No newline at end of file