Match query from search request with batch-response entry

I am creating a search bundle with multiple queries in it, FHIR server returns a batch-response bundle with results.
How can I match/link queries from the request with the responses?

  1. Is the order guaranteed? Is it documented?
  2. I can compare link.url from the response with URL from the query - but it doesn’t feel good enough.

The entries in the response are guaranteed to be an in-order 1…1 match with the entries of the request (though you may also have an extra entry at the end containing an OperationOutcome that applies to the batch as a whole).

1 Like