We have 2 indexes :
Conversation - Contains participants details, last message, etc
{ "_id":123,
"last_message":"Hi",
"from_phone": "+919899988888"
"to_phone":"+919899988889"
...... }
ConversationDetails - list of messages sent/received for a given participants
[{ "conv_id":123, "message":"Hi", "channel": "SMS" "comm_dir":"SENT" "created": 1592992160480 ...... }, { "conv_id":123, "message":"Hi", "channel": "SMS" "comm_dir":"RECEIVED" "created": 1592992160480 ...... },
]
We need to have a field 'lastReceivedMessageSource' in every Conversation Document which is derived from Conversation Details Documents for the given conversations.
We need to migrate this data for millions of conversations. What is the fastest way to do that ?
My approach: is to fetch the values for 'n' conversations and bulk_upsert in the conversation Document.
Note: There are millions of Conversations
E.S Version: 5.6