Skip to content

Add shortcut properties for HistogramOrder #6379

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

Merged
merged 1 commit into from
Apr 26, 2022
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.

namespace Elastic.Clients.Elasticsearch.Aggregations;

public partial class HistogramOrder
{
public static HistogramOrder KeyDescending => new() { Key = SortOrder.Desc };

public static HistogramOrder KeyAscending => new() { Key = SortOrder.Asc };

public static HistogramOrder CountDescending => new() { Count = SortOrder.Desc };

public static HistogramOrder CountAscending => new() { Count = SortOrder.Asc };
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
// 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
namespace Elastic.Clients.Elasticsearch.Aggregations;

public class TermsBucket<TKey> : TermsBucketBase
{
public class TermsBucket<TKey> : TermsBucketBase
{
public TKey Key { get; init; }
public string? KeyAsString { get; init; }
}
public TKey Key { get; init; }
public string? KeyAsString { get; init; }
}
3 changes: 1 addition & 2 deletions src/Playground/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@
.DateHistogram("by-month", dh => dh
.CalendarInterval(CalendarInterval.Month)
.Field(fld => fld.Date)
//.Order(HistogramOrder.KeyDescending)
.Order(new HistogramOrder { Key = SortOrder.Desc })
.Order(HistogramOrder.KeyDescending)
.Aggregations(agg => agg
.Sum("trade-volumes", sum => sum.Field(fld => fld.Volume))))));

Expand Down
1 change: 0 additions & 1 deletion v7
Submodule v7 deleted from f4dcd1