Expression seems incorrect for reference search parameter that's only applicable to certain types


Hi there,

I don’t think the expression is correctly defined in various reference search parameters when the search parameters are restricted to only certain types.

Take appointment as an example:

Appointment.location is a reference search parameter pointing to when actor is a Location resource (if I understood the spec correctly).

However, if you look at the expression of the search parameter (, the expression is defined as:


which will return all actors regardless of the element type. Should the expression be defined as:


instead as specified by FHIR Path ( section 3.2 Paths and polymorphic items?

When I tried that expression with the .NET FHIR SDK, I got error Unknown symbol ‘ofType’. Looks like it hasn’t been implemented yet.

The definition file does contain “Target” resource type, so the workaround could be done by the caller by filtering out the elements returned by FHIR path by examining the reference but that’s cumbersome too since it needs to analyze and the reference string and supports both internal and external references.

Is this a spec issue or am I misunderstanding the spec?



thanks for picking this up - yes, they are being generated incorrectly. I’ve just fixed them in the R4 CI build version. Note, though, that is the correct form: is Location)


Thanks Grahame. Do you want me to fine a tracking issue for this?


no need, thanks - I’ve already fixed it in R4