@@ -48,11 +48,25 @@ public interface IDateHistogramAggregation : IBucketAggregation
4848
4949 public class DateHistogramAggregation : BucketAggregationBase , IDateHistogramAggregation
5050 {
51+ private string _format ;
5152 public Field Field { get ; set ; }
5253 public IScript Script { get ; set ; }
5354 public IDictionary < string , object > Params { get ; set ; }
5455 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+
5670 public int ? MinimumDocumentCount { get ; set ; }
5771 public string TimeZone { get ; set ; }
5872 public int ? Factor { get ; set ; }
@@ -73,6 +87,7 @@ public class DateHistogramAggregationDescriptor<T>
7387 , IDateHistogramAggregation
7488 where T : class
7589 {
90+ private string _format ;
7691 Field IDateHistogramAggregation . Field { get ; set ; }
7792
7893 IScript IDateHistogramAggregation . Script { get ; set ; }
@@ -81,7 +96,18 @@ public class DateHistogramAggregationDescriptor<T>
8196
8297 Union < DateInterval , Time > IDateHistogramAggregation . Interval { get ; set ; }
8398
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+ }
85111
86112 int ? IDateHistogramAggregation . MinimumDocumentCount { get ; set ; }
87113
0 commit comments