# Merge two mongodb collections

**URL:** https://discuss.elastic.co/t/merge-two-mongodb-collections/181177
**Category:** Logstash
**Created:** [May 15, 2019, 12:20pm UTC](https://discuss.elastic.co/t/merge-two-mongodb-collections/181177 "2019-05-15T12:20:36Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Aymen\_Ben\_Moussa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aymen_ben_moussa/32/44513_2.png) [@Aymen\_Ben\_Moussa](https://discuss.elastic.co/u/Aymen_Ben_Moussa)
#### Post date: [May 15, 2019, 12:20pm UTC](https://discuss.elastic.co/t/merge-two-mongodb-collections/181177/1 "2019-05-15T12:20:37Z")

</div>

I have two mongodb collections  
Users and Transactions, since elasticsearch have different approaches when it comes to joins i got stuck on how to make these two collections into one index with nested fields, embeeded, parent child relationship or whatever suits my needs for example i want to know the sum of transactions per age, where age can only be retrieved from Users , continuing my example, in the transactions collections we got the sender\_id and the receiver\_id, that matches the user\_id in the users collection.  
should this happen on the logstash level or elasticsearch after getting the two indices then map their way around, and if so please show me how or give me a example

---

<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 12, 2019, 12:20pm UTC](https://discuss.elastic.co/t/merge-two-mongodb-collections/181177/2 "2019-06-12T12:20:39Z")

</div>

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