-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support geotile_grid aggregation in composite agg sources. (#4271)
(cherry picked from commit c01ec36)
- Loading branch information
Showing
3 changed files
with
80 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
src/Nest/Aggregations/Bucket/Composite/GeoTileGridCompositeAggregationSource.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using System; | ||
using System.Runtime.Serialization; | ||
|
||
namespace Nest | ||
{ | ||
/// <summary> | ||
/// A values source that is equivalent to a simple Geo aggregation. | ||
/// </summary> | ||
public interface IGeoTileGridCompositeAggregationSource : ICompositeAggregationSource | ||
{ | ||
/// <summary> | ||
/// The zoom of the key used to define cells/buckets in the results. | ||
/// </summary> | ||
[DataMember(Name ="precision")] | ||
GeoTilePrecision? Precision { get; set; } | ||
} | ||
|
||
/// <inheritdoc cref="IGeoTileGridCompositeAggregationSource" /> | ||
public class GeoTileGridCompositeAggregationSource : CompositeAggregationSourceBase, IGeoTileGridCompositeAggregationSource | ||
{ | ||
public GeoTileGridCompositeAggregationSource(string name) : base(name) { } | ||
|
||
/// <inheritdoc /> | ||
public GeoTilePrecision? Precision { get; set; } | ||
|
||
/// <inheritdoc /> | ||
protected override string SourceType => "geotile_grid"; | ||
} | ||
|
||
/// <inheritdoc cref="IGeoTileGridCompositeAggregationSource" /> | ||
public class GeoTileGridCompositeAggregationSourceDescriptor<T> | ||
: CompositeAggregationSourceDescriptorBase<GeoTileGridCompositeAggregationSourceDescriptor<T>, IGeoTileGridCompositeAggregationSource, T>, | ||
IGeoTileGridCompositeAggregationSource | ||
{ | ||
public GeoTileGridCompositeAggregationSourceDescriptor(string name) : base(name, "geotile_grid") { } | ||
|
||
GeoTilePrecision? IGeoTileGridCompositeAggregationSource.Precision { get; set; } | ||
|
||
/// <inheritdoc cref="IGeoTileGridCompositeAggregationSource.Precision" /> | ||
public GeoTileGridCompositeAggregationSourceDescriptor<T> Precision(GeoTilePrecision? precision) => | ||
Assign(precision, (a, v) => a.Precision = v); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters