# Indexing CSV data into elasticsearch

**URL:** <https://discuss.elastic.co/t/indexing-csv-data-into-elasticsearch/55871>\
**Category:** Logstash\
**Created:** [July 19, 2016, 11:41am UTC](https://discuss.elastic.co/t/indexing-csv-data-into-elasticsearch/55871 "2016-07-19T11:41:35Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Meenakshi07](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@Meenakshi07](https://discuss.elastic.co/u/Meenakshi07)\
**Post date:** [July 19, 2016, 11:41am UTC](https://discuss.elastic.co/t/indexing-csv-data-into-elasticsearch/55871/1 "2016-07-19T11:41:35Z")

</div>

I have tried the below code to import data from CSV into elasticsearch using logstash:

input {  
file {  
path =\> ["D:\test.csv"]  
type =\> "csv"  
start\_position =\> "beginning"  
}  
}

filter {  
csv {  
columns =\> ["app1", "app2", "c\_strength"]  
separator =\> ","  
}  
}  
output {  
elasticsearch {  
action =\> "index"  
hosts =\> "127.0.0.1"  
index =\> "logstash-CSVTest"  
}  
stdout { codec =\> rubydebug }

Few records from the csv file is getting imported into logstash, but there is no index created to it.

Someone please suggest/correct me. Thanks in advance!

---

<div class="post-metadata">

**Author:** ![polyfractal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/polyfractal/32/48162_2.png) [@polyfractal](https://discuss.elastic.co/u/polyfractal)\
**Post date:** [July 19, 2016, 1:18pm UTC](https://discuss.elastic.co/t/indexing-csv-data-into-elasticsearch/55871/2 "2016-07-19T13:18:05Z")

</div>

Moving to the Logstash forums 🙂

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [July 19, 2016, 9:51pm UTC](https://discuss.elastic.co/t/indexing-csv-data-into-elasticsearch/55871/3 "2016-07-19T21:51:33Z")

</div>

It's probably this [https://www.elastic.co/guide/en/logstash/current/plugins-inputs-file.html#\_tracking\_of\_current\_position\_in\_watched\_files](https://www.elastic.co/guide/en/logstash/current/plugins-inputs-file.html#_tracking_of_current_position_in_watched_files)

---

<div class="post-metadata">

**Author:** ![Meenakshi07](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@Meenakshi07](https://discuss.elastic.co/u/Meenakshi07)\
**Post date:** [July 20, 2016, 5:32am UTC](https://discuss.elastic.co/t/indexing-csv-data-into-elasticsearch/55871/4 "2016-07-20T05:32:43Z")

</div>

I did not understand how can we import csv data into elasticsearch using logstash.

---

<div class="post-metadata">

**Author:** ![Meenakshi07](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@Meenakshi07](https://discuss.elastic.co/u/Meenakshi07)\
**Post date:** [July 20, 2016, 5:33am UTC](https://discuss.elastic.co/t/indexing-csv-data-into-elasticsearch/55871/5 "2016-07-20T05:33:11Z")

</div>

Is there any plugin available for the same?

---

<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:** [July 21, 2016, 6:44pm UTC](https://discuss.elastic.co/t/indexing-csv-data-into-elasticsearch/55871/6 "2016-07-21T18:44:25Z")

</div>

Disable the elasticsearch output for now and pay attention to the `stdout { codec => rubydebug }` output only. Use it to make sure Logstash is reading the input data. Please study the link Mark sent and search the archives for `sincedb_path` and `ignore_older`.

---

<div class="post-metadata">

**Author:** ![Uma\_Ananthu](https://avatars.discourse-cdn.com/v4/letter/u/bbce88/32.png) [@Uma\_Ananthu](https://discuss.elastic.co/u/Uma_Ananthu)\
**Post date:** [February 13, 2017, 2:09pm UTC](https://discuss.elastic.co/t/indexing-csv-data-into-elasticsearch/55871/7 "2017-02-13T14:09:50Z")

</div>

Hi,  
I am new to elastic search and I am trying to import data from csv to elasticsearch using logstash.  
I am using the below logstash conf file

input {  
file {  
path =\> ["D:/AnalyticsTool/Exe/logstash-5.2.0/logstash-5.2.0/bin/data.csv"]  
type =\> "core2"  
start\_position =\> "beginning"  
}  
}  
filter {  
csv {  
separator =\> ","  
columns =\> ["Date","Open","High","Low","Close","Volume","Adj Close"]  
}  
mutate {convert =\> ["High", "float"]}  
mutate {convert =\> ["Open", "float"]}  
mutate {convert =\> ["Low", "float"]}  
mutate {convert =\> ["Close", "float"]}  
mutate {convert =\> ["Volume", "float"]}  
}  
output {  
elasticsearch {  
action =\> "index"  
hosts =\> ["localhost:9200"]  
index =\> "stock"  
workers =\> 1  
user =\> elastic  
password =\> changeme  
}  
stdout { codec =\> rubydebug}  
}

I am not able to visualize in kibana. Do we need to create index manually in elastic search or kibana will create above mentioned index automatically ?  
Please let me know if I am missing anything

Thanks in advance

---

<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 13, 2017, 2:13pm UTC](https://discuss.elastic.co/t/indexing-csv-data-into-elasticsearch/55871/8 "2017-02-13T14:13:32Z")

</div>

@Uma_Ananthu, please start a new topic for your question. I do recommend that you read and understand this topic first. My last recommendations probably apply to you too.

---

<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, 4:28am UTC](https://discuss.elastic.co/t/indexing-csv-data-into-elasticsearch/55871/9 "2017-07-06T04:28:41Z")

</div>


