_elements
Include or exclude specific resource attributes in the search result
A client can request a specific set of elements to be returned as part of a resource in the search results using the _elements parameter:
1
GET /Patient?_elements=birthDate,name.given,address.city
2
3
# resp
4
5
resourceType: Bundle
6
type: searchset
7
entry:
8
- resource:
9
birthDate: '1991-11-08'
10
name: [{ given: [Marat] }]
11
address: [{city: 'Tokio'}]
12
resourceType: Patient
13
- resource:
14
name: [{given: [Abram]}]
15
resourceType: Patient
16
- resource:
17
birthDate: '1965-03-29'
18
name: [{ given: [John] }]
19
address: [{city: 'Los Angeles'}]
20
resourceType: Patient
Copied!
The _elements parameter consists of a comma-separated list of element paths. Only element paths that are listed should be returned. The list of elements does not apply to included resources.

Exclude

If you want to exclude specific elements, you can prefix them with the - sign:
1
GET /Patient?_elements=-text,-identifier
Copied!

Nested Elements

You can include or exclude nested elements using a dot separated path to an element:
1
GET /Patient?_elements=name.given,name.family
Copied!

Elements and (rev)includes

The _elements parameter is not applied to included resources. If you want to filter included resources elements, prefix the element path with resourceType. For example:
1
GET /Encounter?_include=patient&_elements=id,type,Patient.name
Copied!
Result will contain id and type elements from Encounter and name from Patient. The - prefix will exclude elements (for example -Patient.identifier will exclude the identifier from Patient resources).
Last modified 9mo ago