<commit_before>[[date]]
=== Date data type
++++
<titleabbrev>Date</titleabbrev>
++++

JSON doesn't have a date data type, so dates in Elasticsearch can either be:

* strings containing formatted dates, e.g. `"2015-01-01"` or `"2015/01/01 12:10:30"`.
* a long number representing _milliseconds-since-the-epoch_.
* an integer representing _seconds-since-the-epoch_.

Internally, dates are converted to UTC (if the time-zone is specified) and
stored as a long number representing milliseconds-since-the-epoch.

Queries on dates are internally converted to range queries on this long
representation, and the result of aggregations and stored fields is converted
back to a string depending on the date format that is associated with the field.

NOTE: Dates will always be rendered as strings, even if they were initially<commit_msg>Add note about negative epoch times (#61379)<commit_after>[[date]]
=== Date data type
++++
<titleabbrev>Date</titleabbrev>
++++

JSON doesn't have a date data type, so dates in Elasticsearch can either be:

* strings containing formatted dates, e.g. `"2015-01-01"` or `"2015/01/01 12:10:30"`.
* a long number representing _milliseconds-since-the-epoch_.
* an integer representing _seconds-since-the-epoch_.

NOTE: Values for _milliseconds-since-the-epoch_ and _seconds-since-the-epoch_
must be non-negative. Use a formatted date to represent dates before 1970.

Internally, dates are converted to UTC (if the time-zone is specified) and
stored as a long number representing milliseconds-since-the-epoch.

Queries on dates are internally converted to range queries on this long
representation, and the result of aggregations and stored fields is converted
back to a string depending on the date format that is associated with the field.

NOTE: Dates will always be rendered as strings, even if they were initially
{'fraction_non_alphanumeric': 0.0799347471451876, 'fraction_numerical': 0.028820010875475803, 'mean_word_length': 4.878594249201278, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '812555', 'n_tokens_mistral': 542, 'n_tokens_neox': 495, 'n_words': 237}