# Problem setting "data" type

**URL:** <https://discuss.elastic.co/t/problem-setting-data-type/133881>\
**Category:** Logstash\
**Created:** [May 30, 2018, 1:30pm UTC](https://discuss.elastic.co/t/problem-setting-data-type/133881 "2018-05-30T13:30:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Samuele\_Colmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/samuele_colmi/32/31472_2.png) [@Samuele\_Colmi](https://discuss.elastic.co/u/Samuele_Colmi)\
**Post date:** [May 30, 2018, 1:30pm UTC](https://discuss.elastic.co/t/problem-setting-data-type/133881/1 "2018-05-30T13:30:03Z")

</div>

Hello everyone!  
I'm trying to index a .csv file with Logstash.  
One of the field of the file is a string that rappresent a date ("yyyy-MM-dd HH:mm"), and i want to convert this field into a date type at the momento of uploading.  
The filter i'm using is:

filter{   
date{  
match =\> ["logdate", "yyyy-MM-dd HH:mm"]  
}  
mutate {convert =\> ["start", "date"]}  
}

but it's not working, it upload the "start" field as a string.  
Does anyone have any ideas?

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [May 30, 2018, 1:35pm UTC](https://discuss.elastic.co/t/problem-setting-data-type/133881/2 "2018-05-30T13:35:01Z")

</div>

Unless configured otherwise with the `target` option the date filter writes the parsed timestamp to the `@timestamp` field.

---

<div class="post-metadata">

**Author:** ![Samuele\_Colmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/samuele_colmi/32/31472_2.png) [@Samuele\_Colmi](https://discuss.elastic.co/u/Samuele_Colmi)\
**Post date:** [May 30, 2018, 1:48pm UTC](https://discuss.elastic.co/t/problem-setting-data-type/133881/3 "2018-05-30T13:48:17Z")

</div>

and how do I use the target option to configure it?  
thank you so much!

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [May 30, 2018, 2:21pm UTC](https://discuss.elastic.co/t/problem-setting-data-type/133881/4 "2018-05-30T14:21:09Z")

</div>

Set the date filter's `target` option to "start".

[https://www.elastic.co/guide/en/logstash/current/plugins-filters-date.html#plugins-filters-date-target](https://www.elastic.co/guide/en/logstash/current/plugins-filters-date.html#plugins-filters-date-target)

Note that the `start` field in your index has already been mapped as a string. Once set, the mapping of a field in an index can't be changed. If possible, delete the index and start over.

---

<div class="post-metadata">

**Author:** ![Samuele\_Colmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/samuele_colmi/32/31472_2.png) [@Samuele\_Colmi](https://discuss.elastic.co/u/Samuele_Colmi)\
**Post date:** [May 31, 2018, 8:00am UTC](https://discuss.elastic.co/t/problem-setting-data-type/133881/5 "2018-05-31T08:00:00Z")

</div>

it worked!  
thank you so much!

---

<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:** [June 28, 2018, 8:00am UTC](https://discuss.elastic.co/t/problem-setting-data-type/133881/6 "2018-06-28T08:00:09Z")

</div>

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