Inferensys

Glossary

FHIR Search Parameter

A definition that specifies how a client can query a FHIR server for resources based on the value of a specific element, such as searching for a patient by name.
Developer reviewing semantic search engine results on laptop, relevance scores visible, technical search demo.

What is a FHIR Search Parameter?

A formal definition that specifies how a client can query a FHIR server to filter and locate resources based on the value of a specific element, such as searching for a Patient by their name or an Observation by its date.

A FHIR Search Parameter is a named, server-defined construct that maps a query string key to a specific element or combination of elements within a FHIR Resource. It defines the execution logic—such as exact match, prefix, or token matching—that the server uses to evaluate a search expression against its data store, enabling clients to submit queries like GET /Patient?name=Smith.

Each parameter has a declared type (e.g., string, token, date) and a base resource it operates on, formally expressed using the FHIRPath language. Servers expose their supported search parameters via the CapabilityStatement resource, allowing clients to discover which fields are queryable and how to construct valid search interactions.

QUERY MECHANICS

Key Characteristics of Search Parameters

A FHIR Search Parameter defines how a client can query a server for resources based on the value of a specific element. Each parameter specifies a path, a type, and the search processing rules that govern how the server indexes and matches the data.

01

Parameter Type Classification

Search parameters are categorized by data type, which dictates the comparison logic and expected input format:

  • string: Partial, case-insensitive matching (e.g., name=john)
  • token: Exact match on a code system and code pair (e.g., gender=male)
  • date: Range queries on temporal values (e.g., birthdate=gt2020-01-01)
  • quantity: Numeric comparisons with units (e.g., value-quantity=le5.4|mg)
  • reference: Follows links between resources (e.g., subject=Patient/123)
  • composite: Combines two parameters into a single logical pair
02

Modifiers and Prefixes

Clients refine search behavior using modifiers appended to the parameter name and prefixes on values:

  • Modifiers: :exact forces case-sensitive string matching; :contains performs substring search; :text searches on the narrative display
  • Prefixes: eq (equal), ne (not equal), gt (greater than), lt (less than), ge (greater or equal), le (less or equal), sa (starts after), eb (ends before)
  • Chaining: The . notation traverses references, e.g., subject:Patient.name=Smith
03

Search Result Parameters

Standard parameters control pagination and response formatting across all resource types:

  • _count: Limits the number of results returned per page (e.g., _count=50)
  • _include: Requests that referenced resources be returned inline (e.g., _include=Patient:organization)
  • _revinclude: Reverse include, fetching resources that reference the matched set
  • _sort: Orders results by a specified search parameter (e.g., _sort=-date for descending)
  • _elements: Restricts the fields returned to a subset, reducing payload size
  • _summary: Returns a pre-defined subset of data (true, text, data, count, false)
04

Compartment-Based Search

A compartment is a logical grouping of resources related to a specific context, enabling scoped queries:

  • Patient compartment: Retrieves all resources linked to a specific patient (e.g., GET /Patient/123/Observation)
  • Encounter compartment: Fetches resources associated with a single encounter
  • Practitioner compartment: Returns resources tied to a specific provider
  • Compartments simplify access control and reduce the need for complex chained queries
05

Search Parameter Definition Resource

A SearchParameter resource formally defines a parameter's behavior:

  • url: The canonical identifier for the parameter
  • base: The resource types this parameter applies to (e.g., Patient, Observation)
  • expression: A FHIRPath expression pointing to the element being indexed
  • type: The parameter's data type (string, token, reference, etc.)
  • target: For reference parameters, the allowed resource types that can be referenced
  • xpath: Legacy XPath expression for backward compatibility with DSTU2
06

Composite and Special Parameters

Advanced search patterns handle multi-value dependencies:

  • Composite parameters: Combine two values that must be evaluated together, such as code-value-quantity for Observations where the code and value are logically paired
  • _filter: A powerful alternative syntax using a formal grammar for complex boolean logic (e.g., name co "Smith" and birthdate gt 1990)
  • _has: Reverse chaining that tests if a referencing resource matches criteria (e.g., _has:Observation:patient:code=1234-5)
  • _list: Searches for resources that are members of a specific List resource
FHIR SEARCH PARAMETER FAQ

Frequently Asked Questions

Clear, technical answers to the most common questions about how FHIR search parameters work, how they are defined, and how they power precise clinical data queries.

A FHIR search parameter is a formal definition that specifies how a client can query a FHIR server for resources based on the value of a specific element within that resource. It acts as a bridge between a simple query string key-value pair (like ?name=Smith) and the complex, nested structure of a FHIR resource. When a server receives a search request, it consults the SearchParameter resource definition to understand which element to inspect, how to interpret the value, and what FHIRPath expression to evaluate. For example, a search parameter named patient on the Observation resource might define a path of Observation.subject.where(resolve() is Patient) to find all observations for a specific patient. The server then executes this expression against its data store and returns a FHIR Bundle of matching resources.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.