@@ -40,16 +40,21 @@ public interface IDateHistogramAggregation : IBucketAggregation
40
40
[ JsonProperty ( "order" ) ]
41
41
HistogramOrder Order { get ; set ; }
42
42
43
- [ JsonProperty ( "extended_bounds" ) ]
43
+ [ JsonIgnore ]
44
+ [ Obsolete ( "Use ExtendedBoundsDateMath that accepts DateMath expressions. Fixed in NEST 6.x" ) ]
44
45
ExtendedBounds < DateTime > ExtendedBounds { get ; set ; }
45
46
47
+ [ JsonProperty ( "extended_bounds" ) ]
48
+ ExtendedBounds < DateMath > ExtendedBoundsDateMath { get ; set ; }
49
+
46
50
[ JsonProperty ( "missing" ) ]
47
51
DateTime ? Missing { get ; set ; }
48
52
}
49
53
50
54
public class DateHistogramAggregation : BucketAggregationBase , IDateHistogramAggregation
51
55
{
52
56
private string _format ;
57
+ private ExtendedBounds < DateTime > _extendedBounds ;
53
58
public Field Field { get ; set ; }
54
59
public IScript Script { get ; set ; }
55
60
public IDictionary < string , object > Params { get ; set ; }
@@ -59,7 +64,7 @@ public string Format
59
64
{
60
65
get => ! string . IsNullOrEmpty ( _format ) &&
61
66
! _format . Contains ( "date_optional_time" ) &&
62
- ( ExtendedBounds != null || Missing . HasValue )
67
+ ( ExtendedBoundsDateMath != null || Missing . HasValue )
63
68
? _format + "||date_optional_time"
64
69
: _format ;
65
70
set => _format = value ;
@@ -73,7 +78,24 @@ public string Format
73
78
74
79
public string Offset { get ; set ; }
75
80
public HistogramOrder Order { get ; set ; }
76
- public ExtendedBounds < DateTime > ExtendedBounds { get ; set ; }
81
+
82
+ [ Obsolete ( "Use ExtendedBoundsDateMath that accepts DateMath expressions. Fixed in NEST 6.x" ) ]
83
+ public ExtendedBounds < DateTime > ExtendedBounds
84
+ {
85
+ get => _extendedBounds ;
86
+ set
87
+ {
88
+ _extendedBounds = value ;
89
+ ExtendedBoundsDateMath = new ExtendedBounds < DateMath >
90
+ {
91
+ Minimum = value . Minimum ,
92
+ Maximum = value . Maximum
93
+ } ;
94
+ }
95
+ }
96
+
97
+ public ExtendedBounds < DateMath > ExtendedBoundsDateMath { get ; set ; }
98
+
77
99
public DateTime ? Missing { get ; set ; }
78
100
79
101
internal DateHistogramAggregation ( ) { }
@@ -89,6 +111,7 @@ public class DateHistogramAggregationDescriptor<T>
89
111
where T : class
90
112
{
91
113
private string _format ;
114
+ private ExtendedBounds < DateTime > _extendedBounds ;
92
115
Field IDateHistogramAggregation . Field { get ; set ; }
93
116
94
117
IScript IDateHistogramAggregation . Script { get ; set ; }
@@ -101,7 +124,7 @@ string IDateHistogramAggregation.Format
101
124
{
102
125
get => ! string . IsNullOrEmpty ( _format ) &&
103
126
! _format . Contains ( "date_optional_time" ) &&
104
- ( Self . ExtendedBounds != null || Self . Missing . HasValue )
127
+ ( Self . ExtendedBoundsDateMath != null || Self . Missing . HasValue )
105
128
? _format + "||date_optional_time"
106
129
: _format ;
107
130
set => _format = value ;
@@ -117,7 +140,22 @@ string IDateHistogramAggregation.Format
117
140
118
141
HistogramOrder IDateHistogramAggregation . Order { get ; set ; }
119
142
120
- ExtendedBounds < DateTime > IDateHistogramAggregation . ExtendedBounds { get ; set ; }
143
+ [ Obsolete ( "Use ExtendedBoundsDateMath that accepts DateMath expressions. Fixed in NEST 6.x" ) ]
144
+ ExtendedBounds < DateTime > IDateHistogramAggregation . ExtendedBounds
145
+ {
146
+ get => _extendedBounds ;
147
+ set
148
+ {
149
+ _extendedBounds = value ;
150
+ Self . ExtendedBoundsDateMath = new ExtendedBounds < DateMath >
151
+ {
152
+ Minimum = value . Minimum ,
153
+ Maximum = value . Maximum
154
+ } ;
155
+ }
156
+ }
157
+
158
+ ExtendedBounds < DateMath > IDateHistogramAggregation . ExtendedBoundsDateMath { get ; set ; }
121
159
122
160
DateTime ? IDateHistogramAggregation . Missing { get ; set ; }
123
161
@@ -155,9 +193,13 @@ public DateHistogramAggregationDescriptor<T> OrderAscending(string key) =>
155
193
public DateHistogramAggregationDescriptor < T > OrderDescending ( string key ) =>
156
194
Assign ( a => a . Order = new HistogramOrder { Key = key , Order = SortOrder . Descending } ) ;
157
195
196
+ [ Obsolete ( "Use ExtendedBoundsDateMath() that accepts DateMath expressions. Fixed in NEST 6.x" ) ]
158
197
public DateHistogramAggregationDescriptor < T > ExtendedBounds ( DateTime min , DateTime max ) =>
159
198
Assign ( a=> a . ExtendedBounds = new ExtendedBounds < DateTime > { Minimum = min , Maximum = max } ) ;
160
199
200
+ public DateHistogramAggregationDescriptor < T > ExtendedBoundsDateMath ( DateMath min , DateMath max ) =>
201
+ Assign ( a=> a . ExtendedBoundsDateMath = new ExtendedBounds < DateMath > { Minimum = min , Maximum = max } ) ;
202
+
161
203
public DateHistogramAggregationDescriptor < T > Missing ( DateTime missing ) => Assign ( a => a . Missing = missing ) ;
162
204
}
163
205
}
0 commit comments