I have records for call logs that i want to query and combine into 1 result per record instead of 2. This is for logging of calls from one person to another. The person that initiates the call has the 'initiator' flag set to true and the receiver has that flag set to false.
I can query for each of the people separately and that works fine, the problem is when i want to get a record of the complete transaction between the two, i get back both sets of records, while i only want one record with data from both combined.
Below are my records in ES with a sample of the output that i want, that i cant figure out how to write a query for.
{ ... other records }
// Outbound record
{
"id": 211,
"initiator" : true,
"source_name": "John Doe",
"destination_name": "",
"type": 0
}
// Inbound record
{
"id": 211,
"initiator" : false,
"source_name": "",
"destination_name": "Jane Smith",
"type": 4
}
{ ... other records }
----- Desired output
{
"id": 211,
"initiator" : true,
"source_name": "John Doe",
"destination_name": "Jane Smith",
"type": 0
}