Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,12 @@ public class DateHistogramAggregation : BucketAggregationBase, IDateHistogramAgg

public string Format
{
get
{
return !string.IsNullOrEmpty(_format) &&
!_format.Contains("date_optional_time") &&
ExtendedBounds != null
? _format + "||date_optional_time"
: _format;
}
set { _format = value; }
get => !string.IsNullOrEmpty(_format) &&
!_format.Contains("date_optional_time") &&
(ExtendedBounds != null || Missing.HasValue)
? _format + "||date_optional_time"
: _format;
set => _format = value;
}

public int? MinimumDocumentCount { get; set; }
Expand Down Expand Up @@ -94,15 +91,12 @@ public class DateHistogramAggregationDescriptor<T>

string IDateHistogramAggregation.Format
{
get
{
return !string.IsNullOrEmpty(_format) &&
!_format.Contains("date_optional_time") &&
Self.ExtendedBounds != null
? _format + "||date_optional_time"
: _format;
}
set { _format = value; }
get => !string.IsNullOrEmpty(_format) &&
!_format.Contains("date_optional_time") &&
(Self.ExtendedBounds != null || Self.Missing.HasValue)
? _format + "||date_optional_time"
: _format;
set => _format = value;
}

int? IDateHistogramAggregation.MinimumDocumentCount { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ namespace Tests.Aggregations.Bucket.DateHistogram
* From a functionality perspective, this histogram supports the same features as the normal histogram.
* The main difference is that the interval can be specified by date/time expressions.
*
* NOTE: When specifying a `format` **and** `extended_bounds`, in order for Elasticsearch to be able to parse
* the serialized `DateTime` of `extended_bounds` correctly, the `date_optional_time` format is included
* NOTE: When specifying a `format` **and** `extended_bounds` or `missing`, in order for Elasticsearch to be able to parse
* the serialized `DateTime` of `extended_bounds` or `missing` correctly, the `date_optional_time` format is included
* as part of the `format` value.
*
* Be sure to read the Elasticsearch documentation on {ref_current}/search-aggregations-bucket-datehistogram-aggregation.html[Date Histogram Aggregation].
Expand Down