<commit_before>:ref_current: https://www.elastic.co/guide/en/elasticsearch/reference/master

:github: https://github.com/elastic/elasticsearch-net

:nuget: https://www.nuget.org/packages

////
IMPORTANT NOTE
==============
This file has been generated from https://github.com/elastic/elasticsearch-net/tree/master/src/Tests/Tests/Aggregations/Bucket/DateHistogram/DateHistogramAggregationUsageTests.cs. 
If you wish to submit a PR for any spelling mistakes, typos or grammatical errors for this file,
please modify the original csharp file found at the link and submit the PR with that change. Thanks!
////

[[date-histogram-aggregation-usage]]
=== Date Histogram Aggregation Usage

A multi-bucket aggregation similar to the histogram except it can only be applied on date values.
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` 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].

==== Fluent DSL example

[source,csharp]
----
a => a
.DateHistogram("projects_started_per_month", date => date
    .Field(p => p.StartedOn)
    .CalendarInterval(DateInterval.Month)
    .MinimumDocumentCount(2)
    .Format("yyyy-MM-dd'T'HH:mm:ss")
    .ExtendedBounds(FixedDate.AddYears(-1), FixedDate.AddYears(1))
    .Order(HistogramOrder.CountAscending)
    .Missing(FixedDate)<commit_msg>Update date histogram doc (#5109)<commit_after>:ref_current: https://www.elastic.co/guide/en/elasticsearch/reference/master

:github: https://github.com/elastic/elasticsearch-net

:nuget: https://www.nuget.org/packages

////
IMPORTANT NOTE
==============
This file has been generated from https://github.com/elastic/elasticsearch-net/tree/master/src/Tests/Tests/Aggregations/Bucket/DateHistogram/DateHistogramAggregationUsageTests.cs. 
If you wish to submit a PR for any spelling mistakes, typos or grammatical errors for this file,
please modify the original csharp file found at the link and submit the PR with that change. Thanks!
////

[[date-histogram-aggregation-usage]]
=== Date Histogram Aggregation Usage

A multi-bucket aggregation similar to the histogram except it can only be applied on date values.
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`, `hard_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].

==== Fluent DSL example

[source,csharp]
----
a => a
.DateHistogram("projects_started_per_month", date => date
    .Field(p => p.StartedOn)
    .CalendarInterval(DateInterval.Month)
    .MinimumDocumentCount(2)
    .Format("yyyy-MM-dd'T'HH:mm:ss")
    .ExtendedBounds(FixedDate.AddYears(-1), FixedDate.AddYears(1))
    .Order(HistogramOrder.CountAscending)
    .Missing(FixedDate)
{'fraction_non_alphanumeric': 0.10687447815196215, 'fraction_numerical': 0.0027831895352073478, 'mean_word_length': 5.070945945945946, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 8, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3754428', 'n_tokens_mistral': 1047, 'n_tokens_neox': 996, 'n_words': 334}