# ALB-Problem mapping types when importaing CSV via Logstash

**URL:** <https://discuss.elastic.co/t/alb-problem-mapping-types-when-importaing-csv-via-logstash/144117>\
**Category:** Logstash\
**Created:** [August 13, 2018, 9:13am UTC](https://discuss.elastic.co/t/alb-problem-mapping-types-when-importaing-csv-via-logstash/144117 "2018-08-13T09:13:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![alberto.latorre](https://avatars.discourse-cdn.com/v4/letter/a/f14d63/32.png) [@alberto.latorre](https://discuss.elastic.co/u/alberto.latorre)\
**Post date:** [August 13, 2018, 9:13am UTC](https://discuss.elastic.co/t/alb-problem-mapping-types-when-importaing-csv-via-logstash/144117/1 "2018-08-13T09:13:39Z")

</div>

Hello, all.

I have a problem when converting or forcing a the types of csv files.

I want to import into Elasticsearch using Logstash the following file:

12/08/2018-17:56:58,4802,34.25.128.24,Zapatillas de deporte

12/08/2018-17:56:59,26314,32.45.115.24,Bombillas de bajo consumo

12/08/2018-17:57:02,28612,10.135.24.255,Bombillas de bajo consumo

12/08/2018-17:57:06,27649,32.45.115.24,Bombillas de bajo consumo

12/08/2018-17:57:07,10745,10.135.24.255,Lampara de led

12/08/2018-17:57:08,4002,34.25.128.24,Zapatillas de deporte

12/08/2018-17:57:10,20914,295.23.1.0,Lampara de led

12/08/2018-17:57:13,22127,10.135.24.255,Bombillas de bajo consumo

12/08/2018-17:57:16,4808,34.25.128.24,Zapatillas de deporte

And I use this conf file:

[root@nodo2 logstash-6.3.1]# cat logstash\_csv.conf

input {

file {

path =\> ["/var/tmp/datos\_csv.txt"]

start\_position =\> beginning

}

}

filter {

csv {

separator =\> ",";

columns =\> ["momento","cantidad","ip","texto"]

convert =\> { "momento" =\> "date" "cantidad" =\> "integer"}

}

}

output {

stdout { }

elasticsearch {

hosts =\> [[http://192.168.1.140:9200](http://192.168.1.140:9200)]

index =\> alex-csv

workers =\> 1

user =\> elastic

password =\> elastic

}

}

The type for field "cantidad" is "long" and the type for the field "momento" is "text" (following an excerpt of the mapping):  
....  
"cantidad": {  
"type": "long";  
},  
...  
"momento": {  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword",  
"ignore\_above": 256  
}  
}  
},  
...

I cannot see the mistake in the logstash config file. Please, can you help me?.

Thank you very 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:** [August 13, 2018, 1:58pm UTC](https://discuss.elastic.co/t/alb-problem-mapping-types-when-importaing-csv-via-logstash/144117/2 "2018-08-13T13:58:56Z")

</div>

The Ruby CSV converter has no way of knowing whether 12/08/2018 is December 8th or August 12th, so it does not match it. You will need to use a [date](https://www.elastic.co/guide/en/logstash/current/plugins-filters-date.html) filter.

---

<div class="post-metadata">

**Author:** ![alberto.latorre](https://avatars.discourse-cdn.com/v4/letter/a/f14d63/32.png) [@alberto.latorre](https://discuss.elastic.co/u/alberto.latorre)\
**Post date:** [August 14, 2018, 6:53am UTC](https://discuss.elastic.co/t/alb-problem-mapping-types-when-importaing-csv-via-logstash/144117/3 "2018-08-14T06:53:24Z")

</div>

Thank you very much, I will try it and will be back with the result.

---

<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 11, 2018, 7:04am UTC](https://discuss.elastic.co/t/alb-problem-mapping-types-when-importaing-csv-via-logstash/144117/4 "2018-09-11T07:04:55Z")

</div>

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