Depending on how often you expect your update request to fail and how important the ordering is, you can queue the results.
If you give each request an upsert sequence number (like a TCP packet) per document, you can check when a new result comes back to see if it’s out of sequence, and if it is, queue the write operations (or whatever) until the out of order request has returned.
- Upsert request #140 fails on the first two tries, still waiting on the third
- Upsert request #141 fails on the first try, then succeeds on the second
- but #140 hasn’t returned yet, so queue #141’s result
- Continue to handle requests until #140 returns
- Write everything in order (or whatever you do with the results)
If it’s possible for you to drop upsert requests because it fails for too long, you can then remove requests from the queue once it passes a certain threshold, and send the request originator an error message.


















