@@ -36,16 +36,21 @@ public interface IDateHistogramAggregation : IBucketAggregation
36
36
[ JsonProperty ( "order" ) ]
37
37
HistogramOrder Order { get ; set ; }
38
38
39
- [ JsonProperty ( "extended_bounds" ) ]
39
+ [ JsonIgnore ]
40
+ [ Obsolete ( "Use ExtendedBoundsDateMath that accepts DateMath expressions. Fixed in NEST 6.x" ) ]
40
41
ExtendedBounds < DateTime > ExtendedBounds { get ; set ; }
41
42
43
+ [ JsonProperty ( "extended_bounds" ) ]
44
+ ExtendedBounds < DateMath > ExtendedBoundsDateMath { get ; set ; }
45
+
42
46
[ JsonProperty ( "missing" ) ]
43
47
DateTime ? Missing { get ; set ; }
44
48
}
45
49
46
50
public class DateHistogramAggregation : BucketAggregationBase , IDateHistogramAggregation
47
51
{
48
52
private string _format ;
53
+ private ExtendedBounds < DateTime > _extendedBounds ;
49
54
public Field Field { get ; set ; }
50
55
public IScript Script { get ; set ; }
51
56
public IDictionary < string , object > Params { get ; set ; }
@@ -55,7 +60,7 @@ public string Format
55
60
{
56
61
get => ! string . IsNullOrEmpty ( _format ) &&
57
62
! _format . Contains ( "date_optional_time" ) &&
58
- ( ExtendedBounds != null || Missing . HasValue )
63
+ ( ExtendedBoundsDateMath != null || Missing . HasValue )
59
64
? _format + "||date_optional_time"
60
65
: _format ;
61
66
set => _format = value ;
@@ -65,7 +70,24 @@ public string Format
65
70
public string TimeZone { get ; set ; }
66
71
public string Offset { get ; set ; }
67
72
public HistogramOrder Order { get ; set ; }
68
- public ExtendedBounds < DateTime > ExtendedBounds { get ; set ; }
73
+
74
+ [ Obsolete ( "Use ExtendedBoundsDateMath that accepts DateMath expressions. Fixed in NEST 6.x" ) ]
75
+ public ExtendedBounds < DateTime > ExtendedBounds
76
+ {
77
+ get => _extendedBounds ;
78
+ set
79
+ {
80
+ _extendedBounds = value ;
81
+ ExtendedBoundsDateMath = new ExtendedBounds < DateMath >
82
+ {
83
+ Minimum = value . Minimum ,
84
+ Maximum = value . Maximum
85
+ } ;
86
+ }
87
+ }
88
+
89
+ public ExtendedBounds < DateMath > ExtendedBoundsDateMath { get ; set ; }
90
+
69
91
public DateTime ? Missing { get ; set ; }
70
92
71
93
internal DateHistogramAggregation ( ) { }
@@ -81,6 +103,7 @@ public class DateHistogramAggregationDescriptor<T>
81
103
where T : class
82
104
{
83
105
private string _format ;
106
+ private ExtendedBounds < DateTime > _extendedBounds ;
84
107
Field IDateHistogramAggregation . Field { get ; set ; }
85
108
86
109
IScript IDateHistogramAggregation . Script { get ; set ; }
@@ -93,7 +116,7 @@ string IDateHistogramAggregation.Format
93
116
{
94
117
get => ! string . IsNullOrEmpty ( _format ) &&
95
118
! _format . Contains ( "date_optional_time" ) &&
96
- ( Self . ExtendedBounds != null || Self . Missing . HasValue )
119
+ ( Self . ExtendedBoundsDateMath != null || Self . Missing . HasValue )
97
120
? _format + "||date_optional_time"
98
121
: _format ;
99
122
set => _format = value ;
@@ -107,7 +130,22 @@ string IDateHistogramAggregation.Format
107
130
108
131
HistogramOrder IDateHistogramAggregation . Order { get ; set ; }
109
132
110
- ExtendedBounds < DateTime > IDateHistogramAggregation . ExtendedBounds { get ; set ; }
133
+ [ Obsolete ( "Use ExtendedBoundsDateMath that accepts DateMath expressions. Fixed in NEST 6.x" ) ]
134
+ ExtendedBounds < DateTime > IDateHistogramAggregation . ExtendedBounds
135
+ {
136
+ get => _extendedBounds ;
137
+ set
138
+ {
139
+ _extendedBounds = value ;
140
+ Self . ExtendedBoundsDateMath = new ExtendedBounds < DateMath >
141
+ {
142
+ Minimum = value . Minimum ,
143
+ Maximum = value . Maximum
144
+ } ;
145
+ }
146
+ }
147
+
148
+ ExtendedBounds < DateMath > IDateHistogramAggregation . ExtendedBoundsDateMath { get ; set ; }
111
149
112
150
DateTime ? IDateHistogramAggregation . Missing { get ; set ; }
113
151
@@ -142,9 +180,13 @@ public DateHistogramAggregationDescriptor<T> OrderAscending(string key) =>
142
180
public DateHistogramAggregationDescriptor < T > OrderDescending ( string key ) =>
143
181
Assign ( a => a . Order = new HistogramOrder { Key = key , Order = SortOrder . Descending } ) ;
144
182
183
+ [ Obsolete ( "Use ExtendedBoundsDateMath() that accepts DateMath expressions. Fixed in NEST 6.x" ) ]
145
184
public DateHistogramAggregationDescriptor < T > ExtendedBounds ( DateTime min , DateTime max ) =>
146
185
Assign ( a=> a . ExtendedBounds = new ExtendedBounds < DateTime > { Minimum = min , Maximum = max } ) ;
147
186
187
+ public DateHistogramAggregationDescriptor < T > ExtendedBoundsDateMath ( DateMath min , DateMath max ) =>
188
+ Assign ( a=> a . ExtendedBoundsDateMath = new ExtendedBounds < DateMath > { Minimum = min , Maximum = max } ) ;
189
+
148
190
public DateHistogramAggregationDescriptor < T > Missing ( DateTime missing ) => Assign ( a => a . Missing = missing ) ;
149
191
}
150
192
}
0 commit comments