Skip to content

Commit 61b660e

Browse files
committed
Default date histogram format to date_optional_time
This is a better fix for #955. The previous fix, which was to leave the format empty, breaks deserialization to HistogramItem on 1.0.x versions of ES. This is because in later versions of ES, key_as_string is returned in the response by default, whereas in ES 1.0.x, it's only returned if a format is specified.
1 parent 4f32fbe commit 61b660e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Nest/DSL/Aggregations/DateHistogramAggregationDescriptor.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@ public class DateHistogramAggregationDescriptor<T> : BucketAggregationBaseDescri
109109

110110
IDictionary<string, object> IDateHistogramAggregator.ExtendedBounds { get; set; }
111111

112+
public DateHistogramAggregationDescriptor()
113+
{
114+
this.Self.Format = "date_optional_time";
115+
}
116+
112117
public DateHistogramAggregationDescriptor<T> Field(string field)
113118
{
114119
Self.Field = field;

0 commit comments

Comments
 (0)