# How to get date parsing target as a date nor string

**URL:** <https://discuss.elastic.co/t/how-to-get-date-parsing-target-as-a-date-nor-string/317097>\
**Category:** Logstash\
**Created:** [October 20, 2022, 9:58am UTC](https://discuss.elastic.co/t/how-to-get-date-parsing-target-as-a-date-nor-string/317097 "2022-10-20T09:58:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sh.user](https://avatars.discourse-cdn.com/v4/letter/s/e19adc/32.png) [@sh.user](https://discuss.elastic.co/u/sh.user)\
**Post date:** [October 20, 2022, 9:58am UTC](https://discuss.elastic.co/t/how-to-get-date-parsing-target-as-a-date-nor-string/317097/1 "2022-10-20T09:58:58Z")

</div>

Hello,  
I need to parse Field1 as date . I use date filter but when i specify target , i get target as string not date ( by default the timestamp is the target but this is not my need).

date {  
match =\> ["Field1", "dd/MM/yyyy HH:mm:ss", "dd/MM/yyyy HH:mm:ss", "ISO8601"]  
target =\> "Field1"  
}

---

<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:** [October 20, 2022, 3:34pm UTC](https://discuss.elastic.co/t/how-to-get-date-parsing-target-as-a-date-nor-string/317097/2 "2022-10-20T15:34:01Z")

</div>

> [@sh.user](#):
>
> when i specify target , i get target as string not date

Where? If you use `output { stdout { codec => rubydebug } }` is it a date? If you are sending events to elasticsearch and initially sent [Field1] as a string and then added a date filter then any documents arriving at elasticsearch with [Field1] as a date will have it converted to a string until you roll over to a new index, at which point it will start being a date (assuming you have [date detection](https://www.elastic.co/guide/en/elasticsearch/reference/current/dynamic-field-mapping.html#date-detection) enabled, which is on by default).

---

<div class="post-metadata">

**Author:** ![sh.user](https://avatars.discourse-cdn.com/v4/letter/s/e19adc/32.png) [@sh.user](https://discuss.elastic.co/u/sh.user)\
**Post date:** [October 20, 2022, 4:00pm UTC](https://discuss.elastic.co/t/how-to-get-date-parsing-target-as-a-date-nor-string/317097/3 "2022-10-20T16:00:08Z")

</div>

yes in ruby output it is formated as date:  
"Field1" =\> 2022-10-20T15:49:13.352Z  
But in Kibana it is noted as string.

---

<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:** [October 20, 2022, 4:03pm UTC](https://discuss.elastic.co/t/how-to-get-date-parsing-target-as-a-date-nor-string/317097/4 "2022-10-20T16:03:36Z")

</div>

OK, so it is being converted back to a string when it is indexed in elasticsearch. Check the [mapping](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-mapping.html) of the index. You will need to change the mapping, which requires you to reindex the data.

---

<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:** [November 17, 2022, 4:04pm UTC](https://discuss.elastic.co/t/how-to-get-date-parsing-target-as-a-date-nor-string/317097/5 "2022-11-17T16:04:27Z")

</div>

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