Skip to content

Commit 4f8a62c

Browse files
committed
Fix #1525: Add offset to date histogram
1 parent 453eb74 commit 4f8a62c

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

Diff for: src/Nest/DSL/Aggregations/DateHistogramAggregationDescriptor.cs

+15-1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ public interface IDateHistogramAggregator : IBucketAggregator
4343
[JsonProperty("factor")]
4444
int? Factor { get; set; }
4545

46+
[JsonProperty("offset")]
47+
string Offset { get; set; }
48+
4649
[JsonProperty("pre_offset")]
4750
string PreOffset { get; set; }
4851

@@ -69,13 +72,15 @@ public class DateHistogramAggregator : BucketAggregator, IDateHistogramAggregato
6972
public string TimeZone { get; set; }
7073
public bool? PreZoneAdjustLargeInterval { get; set; }
7174
public int? Factor { get; set; }
75+
public string Offset { get; set; }
7276
public string PreOffset { get; set; }
7377
public string PostOffset { get; set; }
7478
public IDictionary<string, string> Order { get; set; }
7579
public IDictionary<string, object> ExtendedBounds { get; set; }
7680
}
7781

78-
public class DateHistogramAggregationDescriptor<T> : BucketAggregationBaseDescriptor<DateHistogramAggregationDescriptor<T>, T>, IDateHistogramAggregator where T : class
82+
public class DateHistogramAggregationDescriptor<T>
83+
: BucketAggregationBaseDescriptor<DateHistogramAggregationDescriptor<T>, T>, IDateHistogramAggregator where T : class
7984
{
8085
private IDateHistogramAggregator Self { get { return this; } }
8186

@@ -101,6 +106,8 @@ public class DateHistogramAggregationDescriptor<T> : BucketAggregationBaseDescri
101106

102107
int? IDateHistogramAggregator.Factor { get; set; }
103108

109+
string IDateHistogramAggregator.Offset { get; set; }
110+
104111
string IDateHistogramAggregator.PreOffset { get; set; }
105112

106113
string IDateHistogramAggregator.PostOffset { get; set; }
@@ -195,11 +202,18 @@ public DateHistogramAggregationDescriptor<T> Interval(int factor)
195202
return this;
196203
}
197204

205+
public DateHistogramAggregationDescriptor<T> Offset(string offset)
206+
{
207+
Self.Offset = offset;
208+
return this;
209+
}
210+
198211
public DateHistogramAggregationDescriptor<T> PreOffset(string preOffset)
199212
{
200213
Self.PreOffset = preOffset;
201214
return this;
202215
}
216+
203217
public DateHistogramAggregationDescriptor<T> PostOffset(string postOffset)
204218
{
205219
Self.PostOffset = postOffset;

0 commit comments

Comments
 (0)