# How to index the csv file data into elasticsearch?

**URL:** <https://discuss.elastic.co/t/how-to-index-the-csv-file-data-into-elasticsearch/301395>\
**Category:** Elasticsearch\
**Created:** [April 2, 2022, 5:58pm UTC](https://discuss.elastic.co/t/how-to-index-the-csv-file-data-into-elasticsearch/301395 "2022-04-02T17:58:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mruthyu](https://avatars.discourse-cdn.com/v4/letter/m/bb73d2/32.png) [@mruthyu](https://discuss.elastic.co/u/mruthyu)\
**Post date:** [April 2, 2022, 5:58pm UTC](https://discuss.elastic.co/t/how-to-index-the-csv-file-data-into-elasticsearch/301395/1 "2022-04-02T17:58:10Z")

</div>

How to index the data from a CSV file into Elasticsearch without using logstash? Looking to get it done through curl command and providing the csv file as input.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 2, 2022, 8:00pm UTC](https://discuss.elastic.co/t/how-to-index-the-csv-file-data-into-elasticsearch/301395/2 "2022-04-02T20:00:35Z")

</div>

You could use an ingest pipeline like this one:

> <https://github.com/dadoonet/bano-elastic/blob/master/elasticsearch-config/ingest-bano.json>

And do something like this for each line:

> <https://github.com/dadoonet/bano-elastic/blob/master/curl_raw_sample.sh>

HTH

---

<div class="post-metadata">

**Author:** ![mruthyu](https://avatars.discourse-cdn.com/v4/letter/m/bb73d2/32.png) [@mruthyu](https://discuss.elastic.co/u/mruthyu)\
**Post date:** [April 3, 2022, 10:30am UTC](https://discuss.elastic.co/t/how-to-index-the-csv-file-data-into-elasticsearch/301395/3 "2022-04-03T10:30:11Z")

</div>

Thanks. Is it not possible to index the events in CSV file using the curl command from different server than Elasticsearch cluster? Whether the data file has to be in JSON format only?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 3, 2022, 11:44am UTC](https://discuss.elastic.co/t/how-to-index-the-csv-file-data-into-elasticsearch/301395/4 "2022-04-03T11:44:43Z")

</div>

Yes. Elasticsearch speaks json.

---

<div class="post-metadata">

**Author:** ![mruthyu](https://avatars.discourse-cdn.com/v4/letter/m/bb73d2/32.png) [@mruthyu](https://discuss.elastic.co/u/mruthyu)\
**Post date:** [April 6, 2022, 9:30am UTC](https://discuss.elastic.co/t/how-to-index-the-csv-file-data-into-elasticsearch/301395/5 "2022-04-06T09:30:12Z")

</div>

Thanks. Whether it will match the index mapping template which has been created if I do the following way in the ingest processor?

{  
"set": {  
"field": "\_index",  
"value": "bano-{{dept}}"  
}

---

<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:** [May 4, 2022, 9:30am UTC](https://discuss.elastic.co/t/how-to-index-the-csv-file-data-into-elasticsearch/301395/6 "2022-05-04T09:30:21Z")

</div>

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