# Cannot parse empty date

**URL:** <https://discuss.elastic.co/t/cannot-parse-empty-date/328687>\
**Category:** Logstash\
**Created:** [March 28, 2023, 8:20am UTC](https://discuss.elastic.co/t/cannot-parse-empty-date/328687 "2023-03-28T08:20:18Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![yuswanul](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yuswanul/32/101662_2.png) [@yuswanul](https://discuss.elastic.co/u/yuswanul)\
**Post date:** [March 28, 2023, 8:20am UTC](https://discuss.elastic.co/t/cannot-parse-empty-date/328687/1 "2023-03-28T08:20:18Z")

</div>

Hi there,

i'm facing an issue about empty date field. so my data is ingested from csv file. and some row has a empty date field. i already made a condition like this  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/2/0/2090c5646051e707807de88e6c4cfcb1a3c6c352.png)

but i keep getting error like this

```auto
response=>{"index"=>{"_index"=>"pgd-2023.03.28", "_type"=>"_doc", "_id"=>"PphGJ4cB90Y937f_h7LS", "status"=>400, "error"=>{"type"=>"mapper_parsing_exception", "reason"=>"failed to parse field [data.listOrder.tglTerima] of type [date] in document with id 'PphGJ4cB90Y937f_h7LS'. Preview of field's value: ''", "caused_by"=>{"type"=>"illegal_argument_exception", "reason"=>"cannot parse empty date"}}}}}

```

I've even used the ruby ​​filter too but still not work

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/a/1/a19d6c4d14d20e113761005d361743740a82e7e4.png)

fyi, i'm using v7.13. anyone can help me?

---

<div class="post-metadata">

**Author:** ![aaron-nimocks](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aaron-nimocks/32/73965_2.png) [@aaron-nimocks](https://discuss.elastic.co/u/aaron-nimocks)\
**Post date:** [March 28, 2023, 2:56pm UTC](https://discuss.elastic.co/t/cannot-parse-empty-date/328687/2 "2023-03-28T14:56:00Z")

</div>

This error is from Elastic. The record is sent from Logstash to Elastic and then Elastic looks at the mapping of the index for the field `data.listOrder.tglTerima` and sees it requires a date field. The mapping parser throws an error saying you sent me a field `data.listOrder.tglTerima` but the data was empty and therefore I can't except this record and then shoots the error back to Logstash.

So you either need to change your mapping on your index for that field to allow for [malformed data](https://www.elastic.co/guide/en/elasticsearch/reference/current/ignore-malformed.html) or remove that field before it's sent in Logstash if you don't need it.

---

<div class="post-metadata">

**Author:** ![yuswanul](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yuswanul/32/101662_2.png) [@yuswanul](https://discuss.elastic.co/u/yuswanul)\
**Post date:** [March 28, 2023, 3:02pm UTC](https://discuss.elastic.co/t/cannot-parse-empty-date/328687/3 "2023-03-28T15:02:40Z")

</div>

Sorry, i just found the root cause. the [data][listOrder] is a array field. so i need to split the field first. Thanks

---

<div class="post-metadata">

**Author:** ![rachel\_gomez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rachel_gomez/32/108615_2.png) [@rachel\_gomez](https://discuss.elastic.co/u/rachel_gomez)\
**Post date:** [March 29, 2023, 5:14am UTC](https://discuss.elastic.co/t/cannot-parse-empty-date/328687/4 "2023-03-29T05:14:24Z")

</div>

Briefly, this error occurs when Elasticsearch is unable to parse a date field because the value is empty. Elasticsearch expects a valid date value for date fields and cannot parse an empty value. To resolve the issue, ensure that the date field has a valid value assigned to it.

Regards,  
Rachel Gomez

---

<div class="post-metadata">

**Author:** ![yuswanul](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yuswanul/32/101662_2.png) [@yuswanul](https://discuss.elastic.co/u/yuswanul)\
**Post date:** [March 29, 2023, 7:25am UTC](https://discuss.elastic.co/t/cannot-parse-empty-date/328687/5 "2023-03-29T07:25:25Z")

</div>

my goal in creating such a condition is to overcome the imperfection of the incoming data. so that the logs with incomplete data can still enter elastic. because this configuration will be put into production. so I can't even be sure whether the data sent to elastic is proper or not

---

<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:** [April 26, 2023, 7:25am UTC](https://discuss.elastic.co/t/cannot-parse-empty-date/328687/6 "2023-04-26T07:25:36Z")

</div>

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