# Load multiple CSV to multiple index in a single conf file

**URL:** https://discuss.elastic.co/t/load-multiple-csv-to-multiple-index-in-a-single-conf-file/220299
**Category:** Logstash
**Created:** [February 21, 2020, 6:58am UTC](https://discuss.elastic.co/t/load-multiple-csv-to-multiple-index-in-a-single-conf-file/220299 "2020-02-21T06:58:51Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![rp12](https://avatars.discourse-cdn.com/v4/letter/r/0ea827/32.png) [@rp12](https://discuss.elastic.co/u/rp12)
#### Post date: [February 21, 2020, 6:58am UTC](https://discuss.elastic.co/t/load-multiple-csv-to-multiple-index-in-a-single-conf-file/220299/1 "2020-02-21T06:58:51Z")

</div>

What is the best way for loading multiple csv files to different indexes from one config file ?

---

<div class="post-metadata">

### Author: ![A\_B](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/a_b/32/17104_2.png) [@A\_B](https://discuss.elastic.co/u/A_B)
#### Post date: [February 25, 2020, 2:47pm UTC](https://discuss.elastic.co/t/load-multiple-csv-to-multiple-index-in-a-single-conf-file/220299/2 "2020-02-25T14:47:58Z")

</div>

Hello @rp12,

this is nothing I would have done before but as no one else has replied I will describe how I would attempt to do this.

I would probably start with Filebeat and see how far I would get using it.  
[https://www.elastic.co/guide/en/beats/filebeat/master/decode-csv-fields.html](https://www.elastic.co/guide/en/beats/filebeat/master/decode-csv-fields.html)

You could ingest directly to Elasticsearch [https://www.elastic.co/guide/en/beats/filebeat/master/elasticsearch-output.html](https://www.elastic.co/guide/en/beats/filebeat/master/elasticsearch-output.html)

Set `index` as `%{[csv_file_name]}` (could get tricky with path delimiters) or a filed name if you have something like that on which you could determine to which index the document should go.

Logstash does have a [CSV filter](https://www.elastic.co/guide/en/logstash/current/plugins-filters-csv.html) as well. You could use a file input using a glob pattern to pick up several CSV files and on the output again use a field name (or what ever could identify a single file) as part of the index name.

My Logstash output looks like this. Maybe it can give you some ideas

```
output {
  elasticsearch {
        hosts => ["10.1.1.1:9200"]
        index => "%{[@metadata][log_prefix]}-%{[@metadata][index]}-%{[@metadata][date]}"
  }
}
```

---

<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: [March 24, 2020, 2:48pm UTC](https://discuss.elastic.co/t/load-multiple-csv-to-multiple-index-in-a-single-conf-file/220299/3 "2020-03-24T14:48:13Z")

</div>

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