# Join two documents

**URL:** <https://discuss.elastic.co/t/join-two-documents/53015>\
**Category:** Logstash\
**Created:** [June 16, 2016, 3:17pm UTC](https://discuss.elastic.co/t/join-two-documents/53015 "2016-06-16T15:17:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chartreuse](https://avatars.discourse-cdn.com/v4/letter/c/edb3f5/32.png) [@Chartreuse](https://discuss.elastic.co/u/Chartreuse)\
**Post date:** [June 16, 2016, 3:17pm UTC](https://discuss.elastic.co/t/join-two-documents/53015/1 "2016-06-16T15:17:26Z")

</div>

Hi,

I have two .csv files. I have a column in each document that is key for me ElasticSearch. When logstash indexes data overwrites the oldest values. Is it possible to keep these values in a table?  
For example :

**Csv file 1:**  
key; string  
1; "abc"  
2; "def"  
3; "ghi"  
2; "jkl"

**Csv file 2:**  
key; number  
1; 50  
2, 47

**ElasticSearch file:**  
key, string, number  
1; "abc"; 50  
2; "jkl"; 47  
3; "ghi"

**What I want:**  
1; ["abc"]; [50]  
2; ["def," jkl "]; [47]  
3; ["ghi"]

---

<div class="post-metadata">

**Author:** ![Glen\_Smith](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/glen_smith/32/111656_2.png) [@Glen\_Smith](https://discuss.elastic.co/u/Glen_Smith)\
**Post date:** [June 17, 2016, 5:55am UTC](https://discuss.elastic.co/t/join-two-documents/53015/2 "2016-06-17T05:55:23Z")

</div>

The documentation for [elasticsearch filter plugin](https://www.elastic.co/guide/en/logstash/current/plugins-filters-elasticsearch.html) [1] gives a rough idea how to accomplish this. You just need to work out the ruby script filter to manage the merging.

[1] [https://www.elastic.co/guide/en/logstash/current/plugins-filters-elasticsearch.html](https://www.elastic.co/guide/en/logstash/current/plugins-filters-elasticsearch.html)

---

<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:52am UTC](https://discuss.elastic.co/t/join-two-documents/53015/3 "2017-07-06T04:52:22Z")

</div>


