# Negative epoch\_millis sometimes throw error while indexing

**URL:** <https://discuss.elastic.co/t/negative-epoch-millis-sometimes-throw-error-while-indexing/260239>\
**Category:** Elasticsearch\
**Created:** [January 5, 2021, 4:38pm UTC](https://discuss.elastic.co/t/negative-epoch-millis-sometimes-throw-error-while-indexing/260239 "2021-01-05T16:38:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![JulienNemo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/juliennemo/32/81785_2.png) [@JulienNemo](https://discuss.elastic.co/u/JulienNemo)\
**Post date:** [January 5, 2021, 4:38pm UTC](https://discuss.elastic.co/t/negative-epoch-millis-sometimes-throw-error-while-indexing/260239/1 "2021-01-05T16:38:50Z")

</div>

Hi,

version: 7.10.1

Have a`"dateOfBirth": { "type": "date" }` field.

I can't index the document with the dateOfBirth:-1555200000  
error : “reason”:“date\_time\_exception: Invalid value for Year (valid values -999999999 - 999999999): -1555200000"

But, I can index a document with dateOfBirth = -379728000000

How possible ?  
I found these information, [https://github.com/elastic/elasticsearch/pull/39734/files](https://github.com/elastic/elasticsearch/pull/39734/files)  
but doesn't seem accurate because why it would work for the 2d document ?

I'm using this website to check the dates:[https://currentmillis.com/](https://currentmillis.com/)

Any help would be appreciate, Thank you

---

<div class="post-metadata">

**Author:** ![JulienNemo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/juliennemo/32/81785_2.png) [@JulienNemo](https://discuss.elastic.co/u/JulienNemo)\
**Post date:** [January 5, 2021, 5:41pm UTC](https://discuss.elastic.co/t/negative-epoch-millis-sometimes-throw-error-while-indexing/260239/2 "2021-01-05T17:41:22Z")

</div>

Spcifying a format in the mappings helps :

```auto
"dateOfBirth": {
          "type": "date",
          "format": "epoch_millis"
        }

```

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [January 5, 2021, 10:43pm UTC](https://discuss.elastic.co/t/negative-epoch-millis-sometimes-throw-error-while-indexing/260239/3 "2021-01-05T22:43:48Z")

</div>

Does that fix the issue?

---

<div class="post-metadata">

**Author:** ![JulienNemo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/juliennemo/32/81785_2.png) [@JulienNemo](https://discuss.elastic.co/u/JulienNemo)\
**Post date:** [January 6, 2021, 9:15am UTC](https://discuss.elastic.co/t/negative-epoch-millis-sometimes-throw-error-while-indexing/260239/4 "2021-01-06T09:15:43Z")

</div>

Yes totally,

I kept the question open in case someone's interested...  
But I can close it

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 3, 2021, 9:15am UTC](https://discuss.elastic.co/t/negative-epoch-millis-sometimes-throw-error-while-indexing/260239/5 "2021-02-03T09:15:45Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
