Skip to content

Commit f2ba42b

Browse files
committed
Merge pull request #1094 from ftoft/histogram-extended_bounds
Support extended_bounds on Histogram
2 parents 8db6849 + efe259a commit f2ba42b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/Nest/DSL/Aggregations/HistogramAggregationDescriptor.cs

+12
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ public interface IHistogramAggregator : IBucketAggregator
2727

2828
[JsonProperty("order")]
2929
IDictionary<string, string> Order { get; set; }
30+
31+
[JsonProperty("extended_bounds")]
32+
IDictionary<string, object> ExtendedBounds { get; set; }
3033
}
3134

3235
public class HistogramAggregator : BucketAggregator, IHistogramAggregator
@@ -37,6 +40,7 @@ public class HistogramAggregator : BucketAggregator, IHistogramAggregator
3740
public double? Interval { get; set; }
3841
public int? MinimumDocumentCount { get; set; }
3942
public IDictionary<string, string> Order { get; set; }
43+
public IDictionary<string, object> ExtendedBounds { get; set; }
4044
}
4145

4246
public class HistogramAggregationDescriptor<T> : BucketAggregationBaseDescriptor<HistogramAggregationDescriptor<T>, T>, IHistogramAggregator
@@ -56,6 +60,8 @@ public class HistogramAggregationDescriptor<T> : BucketAggregationBaseDescriptor
5660

5761
IDictionary<string, string> IHistogramAggregator.Order { get; set; }
5862

63+
IDictionary<string, object> IHistogramAggregator.ExtendedBounds { get; set; }
64+
5965
public HistogramAggregationDescriptor<T> Field(string field)
6066
{
6167
Self.Field = field;
@@ -104,5 +110,11 @@ public HistogramAggregationDescriptor<T> OrderDescending(string key)
104110
return this;
105111
}
106112

113+
public HistogramAggregationDescriptor<T> ExtendedBounds(double min, double max)
114+
{
115+
Self.ExtendedBounds = new Dictionary<string, object> { { "min", min }, { "max", max } };
116+
return this;
117+
}
118+
107119
}
108120
}

0 commit comments

Comments
 (0)