@@ -48,11 +48,25 @@ public interface IDateHistogramAggregation : IBucketAggregation
48
48
49
49
public class DateHistogramAggregation : BucketAggregationBase , IDateHistogramAggregation
50
50
{
51
+ private string _format ;
51
52
public Field Field { get ; set ; }
52
53
public IScript Script { get ; set ; }
53
54
public IDictionary < string , object > Params { get ; set ; }
54
55
public Union < DateInterval , Time > Interval { get ; set ; }
55
- public string Format { get ; set ; }
56
+
57
+ public string Format
58
+ {
59
+ get
60
+ {
61
+ return ! string . IsNullOrEmpty ( _format ) &&
62
+ ! _format . Contains ( "date_optional_time" ) &&
63
+ ExtendedBounds != null
64
+ ? _format + "||date_optional_time"
65
+ : _format ;
66
+ }
67
+ set { _format = value ; }
68
+ }
69
+
56
70
public int ? MinimumDocumentCount { get ; set ; }
57
71
public string TimeZone { get ; set ; }
58
72
public int ? Factor { get ; set ; }
@@ -73,6 +87,7 @@ public class DateHistogramAggregationDescriptor<T>
73
87
, IDateHistogramAggregation
74
88
where T : class
75
89
{
90
+ private string _format ;
76
91
Field IDateHistogramAggregation . Field { get ; set ; }
77
92
78
93
IScript IDateHistogramAggregation . Script { get ; set ; }
@@ -81,7 +96,18 @@ public class DateHistogramAggregationDescriptor<T>
81
96
82
97
Union < DateInterval , Time > IDateHistogramAggregation . Interval { get ; set ; }
83
98
84
- string IDateHistogramAggregation . Format { get ; set ; }
99
+ string IDateHistogramAggregation . Format
100
+ {
101
+ get
102
+ {
103
+ return ! string . IsNullOrEmpty ( _format ) &&
104
+ ! _format . Contains ( "date_optional_time" ) &&
105
+ Self . ExtendedBounds != null
106
+ ? _format + "||date_optional_time"
107
+ : _format ;
108
+ }
109
+ set { _format = value ; }
110
+ }
85
111
86
112
int ? IDateHistogramAggregation . MinimumDocumentCount { get ; set ; }
87
113
0 commit comments