# 2 CSV with relationship

**URL:** <https://discuss.elastic.co/t/2-csv-with-relationship/186308>\
**Category:** Logstash\
**Created:** [June 18, 2019, 4:12pm UTC](https://discuss.elastic.co/t/2-csv-with-relationship/186308 "2019-06-18T16:12:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rori1](https://avatars.discourse-cdn.com/v4/letter/r/50afbb/32.png) [@rori1](https://discuss.elastic.co/u/rori1)\
**Post date:** [June 18, 2019, 4:12pm UTC](https://discuss.elastic.co/t/2-csv-with-relationship/186308/1 "2019-06-18T16:12:23Z")

</div>

Hello,

I have 2 CSV files: 1 containing a list of countries and the second the list of cities of countries. These two files have a CountryId column that allows you to do the relationship.

After integrating the list of countries with Logstash, I would like to include the list of cities as an array in the existing list of countries.

Can you enlighten me on the procedure to follow in the logstash config to reach my goal?

Thank you

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [June 18, 2019, 4:22pm UTC](https://discuss.elastic.co/t/2-csv-with-relationship/186308/2 "2019-06-18T16:22:01Z")

</div>

You could use the list of countries as a dictionary for a [translate](https://www.elastic.co/guide/en/logstash/current/plugins-filters-translate.html) filter. You could then use aggregate to combine the cities for each country. If the list of cities is randomly order that would match [example 3](https://www.elastic.co/guide/en/logstash/current/plugins-filters-aggregate.html#plugins-filters-aggregate-example3) in the documentation. If it is sorted by country id that would match example 4.

---

<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 16, 2019, 4:22pm UTC](https://discuss.elastic.co/t/2-csv-with-relationship/186308/3 "2019-07-16T16:22:03Z")

</div>

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