Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PercentilesAggregation and PercentileRanksAggregation #7923

Merged
merged 1 commit into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,21 @@ namespace Elastic.Clients.Elasticsearch.AsyncSearch;

public sealed partial class AsyncSearchStatusResponse : ElasticsearchResponse
{
/// <summary>
/// <para>Metadata about clusters involved in the cross-cluster search.<br/>Not shown for local-only searches.</para>
/// </summary>
[JsonInclude, JsonPropertyName("_clusters")]
public Elastic.Clients.Elasticsearch.ClusterStatistics? Clusters { get; init; }

/// <summary>
/// <para>If the async search completed, this field shows the status code of the search.<br/>For example, 200 indicates that the async search was successfully completed.<br/>503 indicates that the async search was completed with an error.</para>
/// </summary>
[JsonInclude, JsonPropertyName("completion_status")]
public int? CompletionStatus { get; init; }
[JsonInclude, JsonPropertyName("completion_time")]
public DateTimeOffset? CompletionTime { get; init; }
[JsonInclude, JsonPropertyName("completion_time_in_millis")]
public long? CompletionTimeInMillis { get; init; }
[JsonInclude, JsonPropertyName("expiration_time")]
public DateTimeOffset? ExpirationTime { get; init; }
[JsonInclude, JsonPropertyName("expiration_time_in_millis")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ namespace Elastic.Clients.Elasticsearch.AsyncSearch;

public sealed partial class GetAsyncSearchResponse<TDocument> : ElasticsearchResponse
{
[JsonInclude, JsonPropertyName("completion_time")]
public DateTimeOffset? CompletionTime { get; init; }
[JsonInclude, JsonPropertyName("completion_time_in_millis")]
public long? CompletionTimeInMillis { get; init; }
[JsonInclude, JsonPropertyName("expiration_time")]
public DateTimeOffset? ExpirationTime { get; init; }
[JsonInclude, JsonPropertyName("expiration_time_in_millis")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ namespace Elastic.Clients.Elasticsearch.AsyncSearch;

public sealed partial class SubmitAsyncSearchResponse<TDocument> : ElasticsearchResponse
{
[JsonInclude, JsonPropertyName("completion_time")]
public DateTimeOffset? CompletionTime { get; init; }
[JsonInclude, JsonPropertyName("completion_time_in_millis")]
public long? CompletionTimeInMillis { get; init; }
[JsonInclude, JsonPropertyName("expiration_time")]
public DateTimeOffset? ExpirationTime { get; init; }
[JsonInclude, JsonPropertyName("expiration_time_in_millis")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,16 @@ public override Aggregation Read(ref Utf8JsonReader reader, Type typeToConvert,
return AggregationSerializationHelper.ReadContainer<Elastic.Clients.Elasticsearch.Aggregations.ParentAggregation?>("parent", ref reader, options);
}

if (propertyName == "percentile_ranks")
{
return AggregationSerializationHelper.ReadContainer<Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregation?>("percentile_ranks", ref reader, options);
}

if (propertyName == "percentiles")
{
return AggregationSerializationHelper.ReadContainer<Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregation?>("percentiles", ref reader, options);
}

if (propertyName == "percentiles_bucket")
{
return AggregationSerializationHelper.ReadContainer<Elastic.Clients.Elasticsearch.Aggregations.PercentilesBucketAggregation?>("percentiles_bucket", ref reader, options);
Expand Down Expand Up @@ -545,6 +555,16 @@ public AggregationDescriptor<TDocument> Parent(string name, Action<ParentAggrega
return SetContainer(name, Aggregation.CreateWithAction("parent", configure));
}

public AggregationDescriptor<TDocument> PercentileRanks(string name, Action<PercentileRanksAggregationDescriptor<TDocument>> configure)
{
return SetContainer(name, Aggregation.CreateWithAction("percentile_ranks", configure));
}

public AggregationDescriptor<TDocument> Percentiles(string name, Action<PercentilesAggregationDescriptor<TDocument>> configure)
{
return SetContainer(name, Aggregation.CreateWithAction("percentiles", configure));
}

public AggregationDescriptor<TDocument> PercentilesBucket(string name, Action<PercentilesBucketAggregationDescriptor> configure)
{
return SetContainer(name, Aggregation.CreateWithAction("percentiles_bucket", configure));
Expand Down Expand Up @@ -999,6 +1019,26 @@ public AggregationDescriptor Parent<TDocument>(string name, Action<ParentAggrega
return SetContainer(name, Aggregation.CreateWithAction("parent", configure));
}

public AggregationDescriptor PercentileRanks(string name, Action<PercentileRanksAggregationDescriptor> configure)
{
return SetContainer(name, Aggregation.CreateWithAction("percentile_ranks", configure));
}

public AggregationDescriptor PercentileRanks<TDocument>(string name, Action<PercentileRanksAggregationDescriptor<TDocument>> configure)
{
return SetContainer(name, Aggregation.CreateWithAction("percentile_ranks", configure));
}

public AggregationDescriptor Percentiles(string name, Action<PercentilesAggregationDescriptor> configure)
{
return SetContainer(name, Aggregation.CreateWithAction("percentiles", configure));
}

public AggregationDescriptor Percentiles<TDocument>(string name, Action<PercentilesAggregationDescriptor<TDocument>> configure)
{
return SetContainer(name, Aggregation.CreateWithAction("percentiles", configure));
}

public AggregationDescriptor PercentilesBucket(string name, Action<PercentilesBucketAggregationDescriptor> configure)
{
return SetContainer(name, Aggregation.CreateWithAction("percentiles_bucket", configure));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// 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 HdrMethod
{
/// <summary>
/// <para>Specifies the resolution of values for the histogram in number of significant digits.</para>
/// </summary>
[JsonInclude, JsonPropertyName("number_of_significant_value_digits")]
public int? NumberOfSignificantValueDigits { get; set; }
}

public sealed partial class HdrMethodDescriptor : SerializableDescriptor<HdrMethodDescriptor>
{
internal HdrMethodDescriptor(Action<HdrMethodDescriptor> configure) => configure.Invoke(this);

public HdrMethodDescriptor() : base()
{
}

private int? NumberOfSignificantValueDigitsValue { get; set; }

/// <summary>
/// <para>Specifies the resolution of values for the histogram in number of significant digits.</para>
/// </summary>
public HdrMethodDescriptor NumberOfSignificantValueDigits(int? numberOfSignificantValueDigits)
{
NumberOfSignificantValueDigitsValue = numberOfSignificantValueDigits;
return Self;
}

protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
{
writer.WriteStartObject();
if (NumberOfSignificantValueDigitsValue.HasValue)
{
writer.WritePropertyName("number_of_significant_value_digits");
writer.WriteNumberValue(NumberOfSignificantValueDigitsValue.Value);
}

writer.WriteEndObject();
}
}