-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
If I use the DateHistogram I keep getting a message that the search failed due to the date format.
The search is:
DateTime startDate = DateTime.UtcNow;
DateTime endDate = DateTime.UtcNow.AddDays(1);
.DateHistogram
("orders",
h => h.Field(fi => fi.OrderDate)
.Interval(DateInterval.Day)
.Format("yyyy-MM-dd'T'HH:mm:ss")
.MinimumDocumentCount(0)
.ExtendedBounds(startDate, endDate)))))
And the message I get is:
failed to parse date field [2016-01-03T00:00:00Z] with format [yyyy-MM-dd'T'HH:mm:ss]
I had a look at the ExtendedBounds<T> that is used in the DateHistogramAggregationDescriptor and I think that it does not take into account the format when serialising. I.e. if I serialise a DateTime then I do get the format 2016-01-03T00:00:00Z.
Should the DateHistogram take the format into account when serialising the DateTime values? Alternatively, how can I send the ExtendedBounds with the date values in the format yyyy-MM-dd'T'HH:mm:ss?
Note: I tried calling .ToString("yyyy-MM-dd'T'HH:mm:ss") but extended bounds required a DateTime. I also could not find any tests that use the extended bounds and the format at the same time....