# Could not index event to Elasticsearch. Illegal argument exception

**URL:** <https://discuss.elastic.co/t/could-not-index-event-to-elasticsearch-illegal-argument-exception/199076>\
**Category:** Logstash\
**Tags:** docker\
**Created:** [September 11, 2019, 11:52am UTC](https://discuss.elastic.co/t/could-not-index-event-to-elasticsearch-illegal-argument-exception/199076 "2019-09-11T11:52:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Erich\_King](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/erich_king/32/53990_2.png) [@Erich\_King](https://discuss.elastic.co/u/Erich_King)\
**Post date:** [September 11, 2019, 11:52am UTC](https://discuss.elastic.co/t/could-not-index-event-to-elasticsearch-illegal-argument-exception/199076/1 "2019-09-11T11:52:40Z")

</div>

Hi there.

I am getting the following warning which is clogging up my logs. Would anyone know what the issue might be please?

`[2019-09-11T11:43:42,204][WARN][logstash.outputs.elasticsearch] Could not index event to Elasticsearch. {:status=>400, :action=>["index", {:_id=>nil, :_index=>"operational-2019.09.11", :_type=>"_doc", :routing=>nil}, #<LogStash::Event:0x1540184>], :response=>{"index"=>{"_index"=>"operational-2019.09.11", "_type"=>"_doc", "_id"=>"f_MiIG0BNgglah4k6i5u", "status"=>400, "error"=>{"type"=>"mapper_parsing_exception", "reason"=>"failed to parse field [DEPARTUREDATE] of type [date] in document with id 'f_MiIG0BNgglah4k6i5u'. Preview of field's value: '1900-01-01 00:00:00'", "caused_by"=>{"type"=>"illegal_argument_exception", "reason"=>"failed to parse date field [1900-01-01 00:00:00] with format [strict_date_optional_time||epoch_millis]", "caused_by"=>{"type"=>"date_time_parse_exception", "reason"=>"Failed to parse with all enclosed parsers"}}}}}}`

Thanks so much.

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [September 11, 2019, 12:32pm UTC](https://discuss.elastic.co/t/could-not-index-event-to-elasticsearch-illegal-argument-exception/199076/2 "2019-09-11T12:32:54Z")

</div>

> [@Erich\_King](#):
>
> failed to parse date field [1900-01-01 00:00:00]

elasticsearch stores dates as the number of milliseconds since the epoch. I don't think that number can be negative, so it cannot store dates prior to 1970.

---

<div class="post-metadata">

**Author:** ![Erich\_King](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/erich_king/32/53990_2.png) [@Erich\_King](https://discuss.elastic.co/u/Erich_King)\
**Post date:** [September 12, 2019, 8:19am UTC](https://discuss.elastic.co/t/could-not-index-event-to-elasticsearch-illegal-argument-exception/199076/3 "2019-09-12T08:19:48Z")

</div>

Thanks a lot for this. I know it was a simple one. These dates are hard-coded. I will update to 1990. Should do the trick. Thanks again.

---

<div class="post-metadata">

**Author:** ![Erich\_King](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/erich_king/32/53990_2.png) [@Erich\_King](https://discuss.elastic.co/u/Erich_King)\
**Post date:** [September 13, 2019, 8:23am UTC](https://discuss.elastic.co/t/could-not-index-event-to-elasticsearch-illegal-argument-exception/199076/4 "2019-09-13T08:23:55Z")

</div>

Hi Badger.

I changed the date to be hard coded to '1970-01-01 00:00:00' and am still getting this output. `"reason"=>"failed to parse date field [1970-01-01 00:00:00] with format [strict_date_optional_time||epoch_millis]", "caused_by"=>{"type"=>"date_time_parse_exception", "reason"=>"Failed to parse with all enclosed parsers"}}}}}}`

Could you help please? I am at a loss as to what is going wrong.

---

<div class="post-metadata">

**Author:** ![Erich\_King](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/erich_king/32/53990_2.png) [@Erich\_King](https://discuss.elastic.co/u/Erich_King)\
**Post date:** [September 20, 2019, 9:45am UTC](https://discuss.elastic.co/t/could-not-index-event-to-elasticsearch-illegal-argument-exception/199076/5 "2019-09-20T09:45:04Z")

</div>

I finally managed to solve this. My hard coded date was simply missing the "T" in the middle of the date and time so it should have been "1970-01-01T00:00:00" instead of "1970-01-01 00:00:00".

Thanks for the help @Badger.

---

<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:** [October 18, 2019, 9:45am UTC](https://discuss.elastic.co/t/could-not-index-event-to-elasticsearch-illegal-argument-exception/199076/6 "2019-10-18T09:45:06Z")

</div>

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