Merging two lines with the same id to use as one document

You could either save all the fields of the first line in map, and then drop that event, and add the contents of map to the event when processing the second line, or you stop using aggregate and do a bulk update, as described here.