# How to transfer different structure csv files to existing index in elasticseach

**URL:** https://discuss.elastic.co/t/how-to-transfer-different-structure-csv-files-to-existing-index-in-elasticseach/196758
**Category:** Logstash
**Created:** [August 26, 2019, 11:52am UTC](https://discuss.elastic.co/t/how-to-transfer-different-structure-csv-files-to-existing-index-in-elasticseach/196758 "2019-08-26T11:52:00Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![namali](https://avatars.discourse-cdn.com/v4/letter/n/a87d85/32.png) [@namali](https://discuss.elastic.co/u/namali)
#### Post date: [August 26, 2019, 11:52am UTC](https://discuss.elastic.co/t/how-to-transfer-different-structure-csv-files-to-existing-index-in-elasticseach/196758/1 "2019-08-26T11:52:00Z")

</div>

hotel1 and star csv files merge and transfer to elasticsearch. hotel2.csv just transfer to elasticseach. both data should append to existing index in hotel in elasticsearch

\*hotel1.csv  
hcode  
hname  
starcode

\*star.csv  
starcode  
starrating

\*hotel2.csv  
code  
name  
star

existing index :hotel  
hotelcode  
hotelname  
categorycode  
category

I just want to know how to map csv field with existing index fields  
\*  
hotelcode \<=hotel1.hcode  
hotelname \<=hotel1.hname  
categorycode \<= hotel1.starcode  
category \<= star.starrating

- 

hotelcode \<=hotel2.code  
hotelname \<=hotel2.name  
categorycode  
category \<= hotel2.star

* * *

input {

```
file {
path => "/home/namalie/elk/test/hotel.csv"
start_position=>"beginning"
sincedb_path => "/dev/null"

```

}  
}

filter {  
csv {  
separator =\> ","  
columns =\> ["hcode","hname","starcode"]  
}

translate {  
destination =\> "[@metadata][lookup]"  
dictionary\_path =\> "/home/namalie/elk/test/starrating.csv"  
field =\> "starcode" }  
dissect { mapping =\> { "[@metadata][lookup]" =\> "%{starrating}" } }  
}

output {

elasticsearch {  
hosts =\> ["[http://localhost:9200/](http://localhost:9200/)"]  
index =\>"hotel"  
document\_type =\>"hotel"  
}

stdout {}

}

---

<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: [September 23, 2019, 11:52am UTC](https://discuss.elastic.co/t/how-to-transfer-different-structure-csv-files-to-existing-index-in-elasticseach/196758/2 "2019-09-23T11:52:22Z")

</div>

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