Reindex operation
The $reindex operation requests that all data on the server, or a selected subset of the data on the server, be reindexed.
The $reindex operation can be called in one of two ways, either with a list of urls to be reindexed or with everything=true. If everything=true then the urls parameter is ignored and all resources will be reindexed. Otherwise, only the resources matching the urls are reindexed. The reindex operation uses search URLs to identify resources that should be reindexed. A search URL takes the form:
{resourceType}?[optional search parameters]
For example, the following URL indicates that all resources of type Patient should be reindexed:
Patient?
The following URL indicates that all Observations whose subject is in active should be reindexed:
Observation?subject.active=true
If no URLs are included, then all resources of all types will be reindexed.
Example 1: Reindex a specific set of URLs
POST <baseURL>/$reindex
Content-Type: application/fhir+json
{
"resourceType": "Parameters",
"parameter": [ {
"name": "url",
"valueString": "Patient?active=true"
}, {
"name": "url",
"valueString": "Observation?subject.active=true"
} ]
}
Example 2: Reindex all Practitioner and all Patient resources
POST baseURL/$reindex
Content-Type: application/fhir+json
{
"resourceType": "Parameters",
"parameter": [ {
"name": "url",
"valueString": "Practitioner?"
}, {
"name": "url",
"valueString": "Patient?"
} ]
}
Example 3: Reindex all resources with no parameters or with everything = true
POST baseURL/$reindex
OR
POST baseURL/$reindex
{
"resourceType": "Parameters",
"parameter": [ {
"name": "everything",
"valueBoolean": "true"
}]
}
- Reindex response
The $reindex operation creates a batch job that can be executed asynchronously.
Parent topic: Search parameters