# Logstash csv date deactivate

**URL:** https://discuss.elastic.co/t/logstash-csv-date-deactivate/282764
**Category:** Logstash
**Created:** [August 29, 2021, 8:06pm UTC](https://discuss.elastic.co/t/logstash-csv-date-deactivate/282764 "2021-08-29T20:06:28Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![shariq](https://avatars.discourse-cdn.com/v4/letter/s/9f8e36/32.png) [@shariq](https://discuss.elastic.co/u/shariq)
#### Post date: [August 29, 2021, 8:06pm UTC](https://discuss.elastic.co/t/logstash-csv-date-deactivate/282764/1 "2021-08-29T20:06:28Z")

</div>

Hi,

I am new to the ELK stack.

I am trying to import a CSV that contains Person Data to Elastic search,  
everything is working fine the only problem is that I would like to change the Birth\_date to "text" so i can use it for data matching but the problem is it is automatically set to "date" and i can`t find a solution to change it.

hope somebody can help me, its driving me crazy 😅

---

<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: [August 29, 2021, 8:23pm UTC](https://discuss.elastic.co/t/logstash-csv-date-deactivate/282764/2 "2021-08-29T20:23:18Z")

</div>

There are several possibilities. What is the format of the date field, and what does your input/filter/output configuration file look like?

---

<div class="post-metadata">

### Author: ![shariq](https://avatars.discourse-cdn.com/v4/letter/s/9f8e36/32.png) [@shariq](https://discuss.elastic.co/u/shariq)
#### Post date: [August 30, 2021, 5:29am UTC](https://discuss.elastic.co/t/logstash-csv-date-deactivate/282764/3 "2021-08-30T05:29:32Z")

</div>

the date format is YYYY-MM-DD

```auto
input{
	file {
		path => "/home/demo/csv/demo.csv"
		start_position => "beginning"
		sincedb_path => "/dev/null"
	}

}

filter{
	csv {
		separator => ";"
		columns => ["PERSON_ID","FIRST_NAME","LAST_NAME","BIRTH_DATE"]
	
	}

}

output{
	elasticsearch {
		hosts => "http://localhost:9200"
		index => "demo"
		_id => "%{PERSON_ID}"
	
	}
stdout {}
}

```

i also tried to add to the filter, but it did not work.

```auto
 mutate {
              convert => {"BIRTH_DATE" => "text"}`

```

---

<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: [August 30, 2021, 11:46am UTC](https://discuss.elastic.co/t/logstash-csv-date-deactivate/282764/4 "2021-08-30T11:46:34Z")

</div>

> [@shariq](#):
>
> the date format is YYYY-MM-DD

logstash will be treating that as a string by default. However, elasticsearch will convert that to a date if [dynamic date detection](https://www.elastic.co/guide/en/elasticsearch/reference/current/dynamic-field-mapping.html#date-detection) is enabled (and it is on by default).

---

<div class="post-metadata">

### Author: ![shariq](https://avatars.discourse-cdn.com/v4/letter/s/9f8e36/32.png) [@shariq](https://discuss.elastic.co/u/shariq)
#### Post date: [August 30, 2021, 12:07pm UTC](https://discuss.elastic.co/t/logstash-csv-date-deactivate/282764/5 "2021-08-30T12:07:03Z")

</div>

thanks for your answer,

so the thing that i could not figure out yet is.

if i try to deactivate dynamic date detection it is not possible because the type is already created and data is added to it.

do i need to map the fields first and then add the data?

thats where i am stuck... if i use the import script that i posted the the fields are mapped dynamically and the data is added and i am not able to change the data type anymore.

---

<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: [August 30, 2021, 12:26pm UTC](https://discuss.elastic.co/t/logstash-csv-date-deactivate/282764/6 "2021-08-30T12:26:04Z")

</div>

In elasticsearch, once the type of a field is set, it cannot be changed. You would either need to disable dynamic date detection, or use a [template](https://www.elastic.co/guide/en/elasticsearch/reference/7.14/index-templates.html) to set the mapping. In either case you will need to create a new index.

---

<div class="post-metadata">

### Author: ![shariq](https://avatars.discourse-cdn.com/v4/letter/s/9f8e36/32.png) [@shariq](https://discuss.elastic.co/u/shariq)
#### Post date: [August 30, 2021, 1:19pm UTC](https://discuss.elastic.co/t/logstash-csv-date-deactivate/282764/7 "2021-08-30T13:19:07Z")

</div>

thanks for your help!  
i just created a csv with sample data and used strings and int where i needed it.  
that solved the problem

thanks again

---

<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: [September 27, 2021, 1:19pm UTC](https://discuss.elastic.co/t/logstash-csv-date-deactivate/282764/8 "2021-09-27T13:19:15Z")

</div>

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