# Combining Data in Multiple CSVs to Single Index

**URL:** https://discuss.elastic.co/t/combining-data-in-multiple-csvs-to-single-index/233999
**Category:** Logstash
**Created:** [May 23, 2020, 1:54pm UTC](https://discuss.elastic.co/t/combining-data-in-multiple-csvs-to-single-index/233999 "2020-05-23T13:54:01Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![rukmalf](https://avatars.discourse-cdn.com/v4/letter/r/43a26b/32.png) [@rukmalf](https://discuss.elastic.co/u/rukmalf)
#### Post date: [May 23, 2020, 1:54pm UTC](https://discuss.elastic.co/t/combining-data-in-multiple-csvs-to-single-index/233999/1 "2020-05-23T13:54:01Z")

</div>

Hi,

I have 3 CSVs which I use to create 3 indexes. But the problem is the 1st and 3rd Indexes are connected via the 2nd Index (refer to the image)

 ![elastic_1](https://us1.discourse-cdn.com/elastic/original/3X/9/c/9ce9d1eec95ace066d4f386655a01b63f161f7f1.jpeg)

End of the day I need to get a search result like A1, A2, A3,B1,B2,B3. This would have been easily done using normal DBs. But with ES it seems to be impossible. Hence I have been advised to create a single index with the 3 CSVs

Can this be done using logstash? if so how? If not what are my options?

BR  
Rukmal

---

<div class="post-metadata">

### Author: ![Rahul\_Kumar4](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rahul_kumar4/32/67369_2.png) [@Rahul\_Kumar4](https://discuss.elastic.co/u/Rahul_Kumar4)
#### Post date: [May 23, 2020, 8:14pm UTC](https://discuss.elastic.co/t/combining-data-in-multiple-csvs-to-single-index/233999/2 "2020-05-23T20:14:51Z")

</div>

> [@rukmalf](#):
>
> Hence I have been advised to create a single index with the 3 CSVs

How is that going to solve your problem of getting a output schema like you want `A1,A2,A3,B1,B2,B3`?

One alternate way to try this is to follow the below steps:

Step 1: Index 3 CSVs each into an index of its own using Logstash. Lets call them index `1` (A1,A2,A3) , index `2` (A1,B1) and index `3` (B1, B2, B3).

Step 2: Reingest the docs in index `1` in a new Logstash pipeline by using the [Elasticsearch input plugin](https://www.elastic.co/guide/en/logstash/current/plugins-inputs-elasticsearch.html) and in the filter section of that pipeline use two consecutive [Elasticsearch filter plugins](https://www.elastic.co/guide/en/logstash/current/plugins-filters-elasticsearch.html) to find the matching docs in index `2` and index `3` and pull the fields you want using the [fields](https://www.elastic.co/guide/en/logstash/current/plugins-filters-elasticsearch.html#plugins-filters-elasticsearch-fields) parameter.

---

<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: [June 20, 2020, 8:14pm UTC](https://discuss.elastic.co/t/combining-data-in-multiple-csvs-to-single-index/233999/3 "2020-06-20T20:14:53Z")

</div>

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