Reindexing a HAPI FHIR server after search parameter changes

Reindexing rebuilds search indexes so existing FHIR data matches changed search parameters. This page explains when to run it, how to run it safely on large databases, and how to plan downtime.

On this page

When a HAPI FHIR server needs reindexing after search parameter changes

A HAPI FHIR server needs reindexing when you have changed or added search parameters on a running JPA server and existing resources were stored before that change, so they may not be findable through the new parameters. Reindexing rebuilds the search index entries for stored data so that search can match against the current definitions. It is a day-two operation tied to the database behind the JPA server, not a code deployment step, so the work, its load and its risk all land on that database. Changes that typically call for it include adding a custom search parameter, altering the expression behind an existing one, and activating a parameter that was previously inactive. Confirm in the version you run which parameter changes the documentation says require a reindex, and which are picked up automatically for new writes only.

Before you start a reindex, confirm three things in your environment. First, check the JPA server documentation for your release on reindexing and search parameter handling, because the exact procedure and job names depend on the version. Second, measure the size of the affected resource types in your database, since the amount of data is the main driver of how long the job runs and how much load it adds. Third, confirm that you have a verified backup of the database taken before the change, as described in the backup and disaster recovery topic. Ask your database administrator how the index work will affect connection pools and storage headroom, and whether the job can run alongside normal traffic or needs a window. A reindex that is interrupted or runs against an unexpected schema is far harder to recover from than the change that triggered it, so plan the rollback path before the job starts.

Reindex approaches and when each fits

This table compares the main ways to run a reindex after a search parameter change, from a batch job run during a window to limiting each run to specific resource types. Read each row against your database size and how much downtime your clinical users can absorb, then confirm the job behavior for your HAPI FHIR version before you choose.

ApproachBest fitDowntime and progress trackingWhat to confirm first
Full reindex through the batch job framework, all resource typesSmall test or staging database where a full pass is quick to repeatJob runs against live data; progress is visible through job status, but search results may be incomplete until it finishesConfirm the reindex job name and parameters for your HAPI FHIR version in the upgrade notes
Full reindex scheduled in a maintenance windowLarge production database with a defined low-usage periodPlanned downtime or degraded search for the window; progress is tracked per job, and an overrun needs a rollback planAgree the window length with clinical and operations owners and test the job timing in staging
Reindex limited to specific resource typesChanges that affect one resource type, such as a new Observation search parameterSmaller load and shorter tracking scope; other resource types keep their existing indexVerify which resource types depend on the changed parameter, including chained searches
Reindex processed in ranges or batches across several runsVery large tables where a single pass risks long locks or database pressureSpreads load across runs with no single outage; progress must be recorded by you because each run needs a clear start pointConfirm whether your version supports resumable ranges and how it records the last processed position
Reindex run before the search parameter goes livePlanned changes where the new parameter is added ahead of useMinimal user impact; the parameter is not yet relied on by clientsConfirm whether searches on the new parameter return partial results before the job completes
Reindex after a restore or migration checkDatabase restored from backup or moved between environmentsOften needed in a window with no client traffic; track completion before reopening the endpointCheck whether search indexes were included in the backup or must be rebuilt
Full rebuild as a planned change in a dedicated test copyRehearsing timing and load before productionNo user impact on production; results feed your window estimateUse a copy of production data of similar size and record job duration yourself

How to run a reindex job safely, step by step

This sequence moves a search parameter change from a planned decision to a verified, reopened server, with a backup and a rehearsal in place before any production data is touched. Each step ends with a check that tells the operator whether to continue or stop.

  1. Confirm the search parameter change and target version

    The platform owner and the FHIR or integration lead write down exactly which search parameters changed, which resource types they apply to, and the HAPI FHIR version the server will run after the change. Confirm that version against the HAPI FHIR versions page and the release notes on GitHub, and check that the JDK on the server meets the requirement for that release. Done means a signed change record lists the parameters, resource types, target version and the reason a reindex is needed, so the job scope is not guessed later.

  2. Take and verify a database backup

    The database administrator takes a full backup of the database behind the JPA server and records the backup time, size and location. Restore it to a separate environment, or at minimum confirm with the database tooling that the backup file is readable and complete. Also capture the current server configuration and the binary storage location so all three can be restored together. Done means a restore has been demonstrated on a non-production target, not just a backup file that exists.

  3. Rehearse the reindex on a copy of production data

    The operator restores the verified backup into a staging environment that matches production in database engine, version and approximate data volume. They run the same reindex job there with the same configuration and record how long it took, what errors appeared, and how the server behaved for users during the run. Note any resources that failed or were skipped. Done means the rehearsal log can be compared line by line with the production run plan, and any failures have a documented fix.

  4. Check free disk space and database capacity

    The database administrator measures free storage on the database volume and transaction log space, then compares those figures with the rehearsal's growth and the index space the new parameters will add. Check connection limits and current load on the database so the reindex does not compete with peak traffic. Ask the vendor or your DBA team to confirm the expected growth for your data volume before setting a window. Done means there is recorded headroom above the rehearsal's peak figures, and a go or no-go decision is written down.

  5. Start the reindex job

    During the agreed window, the operator puts the server into the mode defined in the plan, which may mean restricting client traffic at the reverse proxy or gateway, and starts the reindex batch job using the method the chosen HAPI FHIR version documents. Record the job identifier, start time and the configuration in use. Done means the job reports as started and its identifier is stored in the change record, so anyone on shift can find it.

  6. Track progress through job status and logs

    The operator watches the batch job status and the server logs at regular intervals, comparing processed counts against the total expected from the rehearsal. Watch database locks, connection pool use and error messages, and stop the job if errors repeat or progress stalls. Keep the log output for the change record. Done means the job reports completion with no unresolved failed items, or the failed items are listed, classified and accepted by the owner before the next step.

  7. Verify search results on sample queries

    The FHIR lead runs a fixed set of sample searches that use the changed parameters, including chained, modifier and multi-value forms, and compares the results against expected counts recorded before the change and in the rehearsal. Include searches for each resource type in scope. Done means every sample query returns the expected results, and any mismatch has a cause and a fix recorded before traffic is restored.

  8. Reopen traffic and monitor the first period

    Once the search checks pass, the operator removes the traffic restriction in the reverse proxy or gateway, confirms that clients can read and search, and watches error rates, latency and database load through the agreed monitoring. Keep the backup available until the owner signs off that the server has run cleanly. Done means the change record is closed with the job outcome, the verification results, the monitoring snapshot and the owner's sign-off.

How the reindex job moves through the server and database

The diagram starts at the search parameter change and ends with clients resuming traffic. A verified backup must pass before the JPA server starts the reindex job, which the batch job framework runs against the relational database that holds the search indexes. The operator watches job progress through the database and runs test searches before reopening traffic. Keep both gates in the runbook, because a reindex that stops partway can leave searches returning incomplete results.

Reindex flow from parameter change through backup gate, batch job, database and verification.

Running reindex jobs on large databases without surprises

The cost of a reindex on a HAPI FHIR JPA server is set by how much data it must rewrite and how much other work the database is doing at the same time, so measure both before you schedule anything. Reindexing touches the search index tables for every resource of the affected types, so the work grows with the number of resources and the number of search parameters being rebuilt. Index and table sizes also grow during the job, because the database writes new index rows before old ones are cleaned up. Check the current size of the relevant tables and indexes in your PostgreSQL or Microsoft SQL Server instance, and check free disk space against that size with a generous margin. Your own environment is the only reliable baseline, so run the job against a restored copy of production first and record the timings and growth you see.

Concurrent write traffic is the main source of surprises. Every client write to a resource that is still being reindexed competes for the same rows and transaction capacity, and long transactions can hold locks that slow both the job and the application. Plan a maintenance window in which you can stop or limit writes, and if the server cannot be quiet, reduce the number of concurrent clients or route non-urgent traffic elsewhere until the job finishes. Watch active locks, blocked queries, connection pool saturation and the write-ahead log or transaction log growth while the job runs. Your database administrator should agree on alert thresholds before the job starts, because the right values depend on your hardware and workload.

Decide in advance what would make you pause or stop. Typical triggers are sustained lock waits that affect patient-facing reads, disk usage approaching the limit you agreed, replication lag beyond your tolerance, or error rates on the server rising. Confirm how your reindex job is started, monitored and cancelled in the version you run, and check the HAPI FHIR documentation for the job framework features supported by your release. Record who has authority to stop the job, how a partially completed run is resumed, and what state the server is in afterward, so that an interrupted run does not leave search results inconsistent without anyone noticing.

What goes wrong during reindexing and how to prevent it

Reindexing touches every row a search parameter affects, so the failures tend to be quiet: results that look right but are incomplete, a disk that fills mid-job, or a window that runs long. Each card below names one risk, the step that prevents it, and the signal to watch while the job runs.

Incomplete index leaves search wrong

A reindex job can finish with some resources never processed, so searches on the new parameter silently miss matches. Before cutover, compare counts for a sample of resource types and search expressions against a known-good baseline. Watch the job's processed and total counts, and treat any gap as a failed run, not a cosmetic warning.

Database disk exhaustion

Reindexing writes new index rows while the old ones still exist, so free space can drop sharply on a large database. Check available storage and transaction log headroom on PostgreSQL or Microsoft SQL Server before starting, and confirm the backup target has room too. Watch disk usage and write-ahead or log growth during the first hour of the run.

Downtime overruns the window

Reindex duration depends on resource volume, hardware and how much other load the database carries, so a planned window can be exceeded. Measure throughput on a restored copy of production before setting the window, and decide in advance whether to pause, throttle or roll back at a fixed cutoff time. Watch resources processed per minute against the projection.

Writes during reindex go stale

Resources created or updated while the job runs may not be indexed under the new parameter if the job has already passed them. Decide whether to block writes, route them through a read-only window, or run a catch-up pass after the main job. Watch for resources whose last update time is later than the job start.

Failed job with unclear state

An interrupted reindex can leave some resources indexed and others not, with no obvious record of where it stopped. Record the job identifier, the parameter set and the last processed point before starting, and confirm how the server reports failed or partial runs in your version. Watch the job status endpoint and server logs for errors that end the job without a clear completion status.

Rollback that was never tested

Teams often plan a rollback to the previous search parameter set but never run it, so it fails under pressure. Rehearse rollback on the restored copy, including reverting the configuration and confirming searches return the old results. Watch the same count checks used for the forward run, and keep the pre-change backup until the rollback path has been verified.

Questions teams ask before reindexing a HAPI FHIR server

How much effort and cost does a reindex involve?

The cost is mostly the time of the people doing the work, plus any staging capacity you need to rehearse it. Effort rises with the number of resources, how many search parameters changed, how large the database is, and whether you have a tested staging copy to rehearse on. A one-time reindex is different from an ongoing process: it recurs only when search parameters change again. When you request a quote, ask for the work broken into planning, a staging rehearsal, the production run, verification and rollback preparation, so you can see which parts scale with your data volume. Ask the vendor or partner to state which assumptions about data size and environment the figure depends on.

How long does downtime last during a reindex?

Downtime depends on how the reindex is run, how much data must be reprocessed and how much load the database can absorb while the job runs. Search results may be incomplete or inconsistent until the reindex finishes, so teams often decide whether to take the server offline, restrict writes or accept degraded search for a window. The duration you can plan for comes from a rehearsal on a staging copy of your production data, not from general estimates. Measure job progress on that copy, record the rate, then project it onto production. Confirm the exact reindex behavior and job options for your HAPI FHIR version in the HAPI FHIR documentation before you plan the window.

Can our own team run a HAPI FHIR reindex?

Yes, if your team already operates the HAPI FHIR JPA server, its database and its deployment pipeline. The work is well bounded: confirm which search parameters changed, run the reindex job against a staging copy, track progress, verify search results and then repeat in production. The skills that matter most are database operations, Java and Spring Boot troubleshooting, and the ability to restore from backup if something goes wrong. If no one on your team has run a large batch job against a production FHIR database, a rehearsal with an outside partner can build that experience before the production window.

What does the work need from our team?

A reindex needs named owners, a staging environment that matches production closely enough to rehearse, and a current, tested backup before any change. Your team should approve the list of search parameter changes, the maintenance window, the rollback plan and the criteria for declaring the reindex complete. Your database team needs access to watch load and storage growth during the run. Coordinate the change with clinical or application owners who depend on search results, and keep a record of approvals and test results, since compliance reviewers often ask for that evidence. Back up the database, binary storage and configuration together, and confirm you can restore them before you start.

What can go wrong during a large reindex?

The most common problems are running out of database storage or transaction log space, long-running queries that block application traffic, jobs that stop partway and must be resumed or restarted, and search results that look correct in testing but miss records in production. Watch database connection pools, CPU and disk throughput during the run. Verify a sample of searches against known records before and after, and keep the backup from before the change until the results are accepted. Plan a rollback path, even if you expect the reindex to succeed, because a partially completed job can leave the database in a state that needs careful handling.

How should we track reindex progress and check the results?

Track progress through the job status that HAPI FHIR exposes for batch jobs, combined with database metrics such as active queries, locks and storage use. Record the start time, the processed count and the completion state, and compare the processed count against the number of resources you expect to reindex. Then run a fixed set of test searches for each changed parameter and compare the results with known data. Store these checks with the change record so the team can show what was verified and when.

When should we bring in outside help for a reindex?

Bring in outside help when the reindex affects a regulated production system and your team has not run a large batch job on that database before, when downtime windows are tight, or when the data volume is large enough that a staging rehearsal is needed to set a safe plan. A partner can also help define the scope in writing, prepare runbooks and verification steps, and support the production run. Ask any partner to describe the written scope, deliverables and timeline before work starts, and to explain what they will verify and what remains your responsibility.

How DeployOpen plans and runs HAPI FHIR reindexing

DeployOpen treats a reindex after search parameter changes as a planned change to a live FHIR server, not a one-off command. We scope the affected resources and search parameters, rehearse the job on a copy of your database, and hand over a runbook your team can repeat. Engagements are fixed-scope, with the work agreed in writing before it starts.

How we scope

  • Inventory the search parameter changes and the resource types whose indexes they affect on your server
  • Agree in writing which reindex jobs run, the database size and environment they touch, and the acceptance checks
  • Confirm the downtime window, rollback point and who approves go-live with your clinical and platform owners

How we build

  • Rehearse the reindex job on a restored copy of your production database and record the time and resource use
  • Configure job progress tracking and logging so your team can see completion and failures during the run
  • Test search results before and after the reindex with representative queries that depend on the changed parameters

How we hand over

  • Deliver a runbook covering pre-checks, a verified backup before the job, the run steps and the rollback path
  • Document downtime planning, monitoring signals to watch and the criteria for stopping or resuming a job
  • Walk your operations team through a dry run so they can repeat the process on later search parameter changes

How we support

  • Offer ongoing support, upgrades and continuous testing as a retainer after the initial reindex
  • Retest search behavior when HAPI FHIR upgrades or new search parameters change the index requirements
  • Confirm with your team which support hours, response terms and service levels a retainer will include before signing

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.