# Struggle in export the data from csv to elasticsearch

**URL:** <https://discuss.elastic.co/t/struggle-in-export-the-data-from-csv-to-elasticsearch/42211>\
**Category:** Logstash\
**Created:** [February 19, 2016, 6:37am UTC](https://discuss.elastic.co/t/struggle-in-export-the-data-from-csv-to-elasticsearch/42211 "2016-02-19T06:37:21Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Croos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/croos/32/29489_2.png) [@Croos](https://discuss.elastic.co/u/Croos)\
**Post date:** [February 19, 2016, 6:37am UTC](https://discuss.elastic.co/t/struggle-in-export-the-data-from-csv-to-elasticsearch/42211/1 "2016-02-19T06:37:21Z")

</div>

I have a csv file. It contains 13 columns and more than 150 000 rows.

 ![](https://us1.discourse-cdn.com/elastic/original/2X/a/ac2cfbffeb4fe710ce3da0951966fe1bb60a2010.png)

When I use the following config, There is no output on the logstash.

```
input {
  file {
    path => "/salaries.csv"
    start_position => "beginning"
    type => "data"
  }
}

filter {
  csv{
    separator => ","
  }
}

output {
  stdout { 
    codec => rubydebug 
  }
}

```

would you please give me a basic solution for this case.

---

<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:** [February 19, 2016, 6:57am UTC](https://discuss.elastic.co/t/struggle-in-export-the-data-from-csv-to-elasticsearch/42211/2 "2016-02-19T06:57:14Z")

</div>

Logstash is tailing the file. Set `sincedb_path` to "/dev/null" if you want Logstash to unconditionally process a file from the top. The file input documentation explains how this works.

---

<div class="post-metadata">

**Author:** ![Croos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/croos/32/29489_2.png) [@Croos](https://discuss.elastic.co/u/Croos)\
**Post date:** [February 19, 2016, 9:27am UTC](https://discuss.elastic.co/t/struggle-in-export-the-data-from-csv-to-elasticsearch/42211/3 "2016-02-19T09:27:57Z")

</div>

Thanks a lot Magnus. Now its work.  
Now my question is When we import the data from csv file, How to mapping a schema? Because the all document types are stored as string format in elastic server.  
i.e: The jdbc plugin automatically get the database column type.  
In this case any predefined method? or where we can specify the datatype of an document in the config file?

---

<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:** [February 19, 2016, 12:18pm UTC](https://discuss.elastic.co/t/struggle-in-export-the-data-from-csv-to-elasticsearch/42211/4 "2016-02-19T12:18:23Z")

</div>

The keyword here is "mappings". Either set the mappings when you create the index or use an index template to automatically apply at set of mappings for all new indexes that match a particular pattern.

Absent explicit mappings, ES will attempt to guess what data type each field has.

---

<div class="post-metadata">

**Author:** ![Croos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/croos/32/29489_2.png) [@Croos](https://discuss.elastic.co/u/Croos)\
**Post date:** [February 29, 2016, 6:55am UTC](https://discuss.elastic.co/t/struggle-in-export-the-data-from-csv-to-elasticsearch/42211/5 "2016-02-29T06:55:28Z")

</div>

ok. thank you.

---

<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:** [July 6, 2017, 5:09am UTC](https://discuss.elastic.co/t/struggle-in-export-the-data-from-csv-to-elasticsearch/42211/6 "2017-07-06T05:09:27Z")

</div>


