Merge two mongodb collections

(Aymen Ben Moussa) #1

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