<commit_before>[[search-aggregations-bucket-daterange-aggregation]]
=== Date Range Aggregation

A range aggregation that is dedicated for date values. The main difference between this aggregation and the normal <<search-aggregations-bucket-range-aggregation,range>> aggregation is that the `from` and `to` values can be expressed in Date Math expressions, and it is also possible to specify a date format by which the `from` and `to` response fields will be returned.
Note that this aggregration includes the `from` value and excludes the `to` value for each range.

Example:

[source,js]
--------------------------------------------------
{
    "aggs": {
        "range": {
            "date_range": {
                "field": "date",
                "format": "MM-yyy",
                "ranges": [
                    { "to": "now-10M/M" },
                    { "from": "now-10M/M" }
                ]
            }
        }
    }
}
--------------------------------------------------
<commit_msg>Update daterange-aggregation.asciidoc<commit_after>[[search-aggregations-bucket-daterange-aggregation]]
=== Date Range Aggregation

A range aggregation that is dedicated for date values. The main difference between this aggregation and the normal <<search-aggregations-bucket-range-aggregation,range>> aggregation is that the `from` and `to` values can be expressed in <<date-math,Date Math>> expressions, and it is also possible to specify a date format by which the `from` and `to` response fields will be returned.
Note that this aggregration includes the `from` value and excludes the `to` value for each range.

Example:

[source,js]
--------------------------------------------------
{
    "aggs": {
        "range": {
            "date_range": {
                "field": "date",
                "format": "MM-yyy",
                "ranges": [
                    { "to": "now-10M/M" }, <1>
                    { "from": "now-10M/M" } <2>
                ]
            }
        }
    }
}
--------------------------------------------------
<1> < now minus 10 months, rounded down to the start of the month.
<2> >= now minus 10 months, rounded down to the start of the month.

{'fraction_non_alphanumeric': 0.19119669876203577, 'fraction_numerical': 0.007336084364970197, 'mean_word_length': 1.7585335018963337, 'pattern_counts': {'":': 16, '<': 14, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '1794528', 'n_tokens_mistral': 585, 'n_tokens_neox': 551, 'n_words': 207}