The whole point of doc_as_upsert is that if the document does not exist it will get created. You can use doc_as_upsert on both. If A sends the document first it will insert and B will update. If B sends the document first then B will insert and A will update.
If they both send it at the same time then I would trust Elastic to have locking in place to resolve the race so that one is an insert and the other an update.