Customizing Orthanc MainDicomTags for faster search

Orthanc answers C-FIND and REST searches fastest on the tags it indexes. This page explains how to extend MainDicomTags, what each choice costs, and how to update studies already stored.

On this page

Why Orthanc MainDicomTags decides how fast your searches run

When a search on a DICOM tag outside the default set is slow or misses studies your team expects to find, the cause is often indexing rather than the query itself. In Orthanc, MainDicomTags sets which DICOM tags the server extracts and indexes when an instance is ingested, and ExtraMainDicomTags adds further tags to that set. A tag that is not indexed cannot be matched efficiently in C-FIND or in the REST search routes, so the archive has to answer the query another way, which costs time and can produce results that differ from what your team expects.

Teams usually need this when a local workflow depends on a field the default list does not cover, such as a site-specific accession format, a referring identifier, or a private tag that a downstream system uses to route studies. Before changing anything, confirm the exact default tag list in the Orthanc release you run, because the list is part of the configuration and can differ between versions. Check the current behavior in the Orthanc Book and in the release notes for your version, and record which tags your modalities, viewers and scripts actually query.

The change affects new ingests first. Instances already stored keep the index they were created with, so a search for a newly added tag may miss older studies until they are reindexed. Plan that gap explicitly: decide whether historical studies must be searchable on the new tag, estimate the reindexing work on a copy of the archive, and agree with the operations owner when it will run. Test the change on a non-production instance with representative data first, because the effect on ingest time and index size depends on the size of your archive and the storage behind it.

How a C-FIND or REST search reads the Orthanc index

The diagram starts with a DICOM instance arriving from a modality or a REST upload. Orthanc extracts the tags listed in MainDicomTags and any added through ExtraMainDicomTags and writes them to the index database. A C-FIND or REST query is matched against those indexed values first, and only the matching instances are read from storage. Tags that were never indexed cannot be matched this way, so check them before go-live and run the re-indexing path for studies that were stored before a configuration change.

Search matches indexed tags before any stored file is read.

Which MainDicomTags settings fit which search pattern

This table compares the default MainDicomTags list, ExtraMainDicomTags, sequence-related limits and re-indexing of existing studies. Read each row as a question to answer in your own release's configuration reference before changing anything, and match the row to the searches your users actually run.

OptionWhat it changesWhen it fits a search patternWhat to confirm for your release
Default MainDicomTagsSets the DICOM tags Orthanc indexes for every instance without any extra configurationSearches by patient, study, series and common identifiers that the built-in list already coversCheck the default tag list in the configuration reference for the Orthanc release you run, because the list can change between versions
ExtraMainDicomTagsAdds site-chosen tags to the indexed set so C-FIND and REST queries can match on themLocal accession numbers, referring physician names or other site-specific tags that users search by regularlyConfirm the exact syntax and tag format the key accepts in your release, and test a query before rolling it out
Sequence-related limitsControls how sequence items are read and whether values nested inside sequences are indexedSearches that depend on values stored inside DICOM sequences rather than top-level attributesConfirm the limits and sequence handling options in your release, and check how deep nesting is treated before relying on it
Re-indexing existing studiesApplies a changed tag list to studies already stored, not only to new arrivalsAny site that adds or changes tags after its archive already holds data it needs to searchConfirm the re-indexing method and its impact on a large archive with your release notes, and plan a test on a copy first
Searches on tags not indexedQueries on unindexed tags may return incomplete results or run slowly against stored filesAd hoc searches a site runs rarely and does not need to speed upConfirm how your release handles unindexed query keys and whether a slower fallback is acceptable for those searches

Configure ExtraMainDicomTags and verify the index

This sequence turns a list of slow or missing searches into a tested change to Orthanc's indexed tags. The output is a configuration that a test instance has loaded cleanly, with before and after query results recorded and compared.

  1. Identify the slow and missing searches

    Collect the C-FIND and REST queries your users and systems run most often, and note which ones are slow or return no results because the criteria are not indexed. Record the exact query parameters, the expected study, and how long each query takes today. Ask the modality and application owners which fields they filter on, since their query logs are the most reliable source. The step is done when you have a written list of queries with their current behavior and expected results.

  2. List candidate tags with their identifiers

    For each slow query, identify the DICOM attribute it filters on and write down its tag identifier in the form gggg,eeee, along with its keyword and value representation. Check the DICOM standard's data dictionary for each identifier rather than relying on memory, and confirm which level (patient, study, series or instance) the attribute belongs to. Remove any tag that is already in the default MainDicomTags list, since Orthanc indexes it already. The output is a short table of candidate tags tied to specific queries.

  3. Back up the current configuration file

    Before editing anything, copy the production or test Orthanc configuration file to a dated location under version control or in a secured backup folder, and record the Orthanc version in use. Keep the original file unchanged so that you can restore it if the change fails to load. The step is done when the copy exists, can be opened, and matches the running configuration.

  4. Add the tags to ExtraMainDicomTags on a test instance

    On a separate test instance, add the candidate tags to the ExtraMainDicomTags setting in the configuration file, using the format the Orthanc Book shows for your version. Keep the list short and limited to tags that your queries need, since each indexed tag adds work during ingest and storage in the database. Confirm the setting name and syntax against the official configuration reference for your Orthanc version before you save the file.

  5. Check syntax and restart the service cleanly

    Validate the JSON syntax of the configuration file with a JSON parser, then restart the Orthanc service. Check the service logs for startup errors and confirm that the process is running and that the REST API responds on its system endpoint. If the service fails to start, restore the backed-up file and compare the two versions line by line. The step is done when the service runs with the new configuration and logs show no configuration errors.

  6. Ingest sample studies and run before and after queries

    Ingest a set of sample studies that contain the target attributes, ideally including studies ingested before the change and studies ingested after it. Run the same C-FIND and REST queries you recorded in the first step, and capture the results and response times. Because tags are indexed at ingest, expect that studies stored before the change may not match new criteria until they are updated, which is covered in the next step. Record every result in the same table for comparison.

  7. Confirm results and test a known study

    Compare the before and after results and confirm that a test query returns the expected study for each new criterion. Check for false matches by querying with values that should return nothing, and verify that the returned study identifiers match the study you know to be correct. Compare timings to confirm the searches run faster on the test instance. The step is done when every query in your list returns the expected result and the findings are recorded for the production change decision.

Trade-offs of indexing more DICOM tags

Every extra tag you index changes what Orthanc does on ingest, how large the index grows, and which database you need to keep queries fast. The cards below cover the decisions that follow from adding tags, and the checks to run before you change the list in production.

Extra work at every ingest

Orthanc reads each tag in ExtraMainDicomTags from every instance it stores, so the list you choose sets the parsing cost of every study that arrives. A longer list adds work to each file, including files from modalities that send in bulk. Measure ingest time with a representative batch of your own modalities before and after the change, and do not assume the cost is negligible for a busy site.

Scalability FAQ

Index growth per tag

Each indexed tag adds rows to the index database for every instance and series it covers, so index size grows with the number of tags as well as with the number of studies. Estimate the growth on a copy of your archive by indexing the new tags and comparing the database size. Plan storage for the index separately from DICOM files, because the two grow at different rates.

Sequence tags with many values

Some tags are sequences that can hold several values in one instance, such as repeated items inside a sequence. Orthanc applies limits to how many sequence items it stores as index values, so a tag that looks single-valued in your sample may return partial results in production. Check the sequence limit settings against real files that carry repeated items before you rely on a search over them.

Mismatch between old and new studies

Studies stored before a change to the tag list are not indexed for the new tags until they are re-indexed. A search that works for last week's studies can silently miss last year's, which looks like a data problem to clinical users. Decide whether to re-index the existing archive, and record the date of the change so that search results can be read correctly during the transition.

Database choice for large archives

The built-in SQLite index is intended for smaller datasets, and the Orthanc docs recommend an enterprise engine once an archive reaches several hundred thousand instances. More indexed tags increase the load on the index, which can move the point where SQLite stops being adequate. Confirm your expected instance count and tag count together, then decide between SQLite and the PostgreSQL plugin before you finalize the list.

Orthanc plugins

Testing against sample data

A search that is fast on a few hundred test studies can behave differently on an archive with millions of values, and tag values in real modality output vary more than synthetic files. Build a test set from de-identified exports of your own modalities, include multi-value sequences and older studies, and time the queries your users run. Ask whether the test effort is part of the fixed scope when you request a quote.

Updating existing studies after the MainDicomTags change

A change to MainDicomTags or ExtraMainDicomTags does not make the new tags searchable on studies Orthanc already holds. Those studies were indexed under the old configuration, so the new tags are missing from the index until the affected resources are re-indexed. Treat the configuration edit and the re-indexing as two separate steps, and plan the second one before you touch production. Which re-indexing method applies depends on the Orthanc release you run and on the index database behind it, including whether you use the built-in SQLite index or a plugin such as PostgreSQL. Confirm the method for your exact version in the Orthanc Book and, if the answer is unclear, with Orthanc Team before you start.

Test the procedure on a copy of the archive, never on the only live index. Restore a representative subset of studies into a separate instance with the same Orthanc version, database engine and storage layout, apply the new configuration, and run the re-indexing step. Record the elapsed time, CPU use, database load and disk I/O for that subset, then extrapolate to the full archive with a safety margin. Pay particular attention to studies with large sequences, because the tags you added may be inside sequence items that the sequence limits in your configuration cap. Check afterward that a C-FIND or REST query on the new tag returns the same results as a full scan of the test copy.

Schedule the production run outside clinical hours and give it a defined rollback point. Re-indexing competes with ingest, retrieval and viewer traffic for database and disk resources, so agree the window with clinical operations and the imaging team in advance. Confirm that a current backup of the index database and the DICOM storage exists before the run starts, and keep the previous configuration file so you can revert. Monitor the database and storage during the run, verify query results on a sample of studies when it finishes, and document the Orthanc version, the procedure used and the measured timings so that future tag changes start from evidence rather than estimates.

Security and operational considerations for tuned search

Adding tags to the Orthanc index makes search faster, but it also copies more patient-identifying data into a second store that users, backups and administrators can reach. The cards below cover the controls to set before and after a MainDicomTags change so that the tuned index does not widen exposure.

Index access matches file access

The index holds the values of the tags you choose to extract, and many of those values are patient-identifying, such as names, IDs and dates. Treat the index database with the same access controls, encryption and audit logging as the DICOM files. Check who can run queries directly against the database, not only who can use the REST API.

Lock down remote access first

Orthanc accepts HTTP connections only from localhost by default. If RemoteAccessAllowed is enabled, set AuthenticationEnabled to true and define users in RegisteredUsers before any search change goes live. For Internet exposure, put Orthanc behind HTTPS and a reverse proxy, as the Orthanc Book recommends.

Orthanc security FAQ

Keep script and export routes disabled

The Orthanc security FAQ warns that the /tools/execute-script route can let a malicious user run any system command, and that the export route can overwrite files. Confirm both stay disabled in every environment where the tuned configuration is deployed, including test copies, since a tag change is often tested on a copy of production.

Plan a larger backup scope

Every extra indexed tag enlarges the index, so backups and restores must cover the index as well as the DICOM storage. Ask how long a restore of the index takes at your archive size, and whether the index can be rebuilt from files if it is lost. Test a restore after the change, not only before it.

Record changes and approvals

Store each change to MainDicomTags or ExtraMainDicomTags in version control with the reason, the tester and the approver. Note which tags were added, which study levels they apply to, and the date the existing studies were updated. This record lets auditors and security reviewers tie a search behavior change to an approved decision.

Test for unintended data exposure

A newly indexed tag can make studies findable by values that some users should not search on. Before release, run queries as each user role and confirm that results and the returned fields match policy. If you use the advanced authorization plugin, confirm its external service denies requests with HTTP 403 for the restricted roles.

Authorization plugin docs

What teams ask before tuning MainDicomTags

How much work does a MainDicomTags change take?

The effort depends on how many tags change, how large the archive is, which database engine holds the index, and how much testing exists before production. Adding a few well-chosen tags to a small test instance is a short exercise, while a change applied to a large archive means planning a re-index window, checking disk and database load, and validating search results against real queries. Ask any provider for a written scope that lists the tags, the archive size they assume, the database engine, the test environment and the verification steps. Pricing follows from that scope, so request a written quote rather than comparing estimates built on different assumptions.

Can our internal team change MainDicomTags without a partner?

Yes, a team with Orthanc administration experience can edit the configuration and test it, provided it has a test instance that mirrors production. The work involves reading the configuration keys, listing the tags your users search on, confirming how the chosen database handles the change, and running queries before and after. Teams without a test copy or without experience in DICOM tag semantics usually take longer and carry more risk on a live archive. A partner can help where a fixed scope and written verification are needed, and DeployOpen plans and implements Orthanc deployments inside the client's own infrastructure.

What must we provide before the work starts?

Most of the input comes from your clinical and operations teams, and the list is short but specific. Gather a set of anonymized or de-identified sample studies that reflect your modalities and sequence-heavy exams, the list of search fields your users and integrations actually query, access to a test Orthanc instance with a copy of the database, and a maintenance window agreed with the people who own the production archive. Your security team should also approve how sample data is handled. Missing any of these items usually extends the schedule because verification cannot start.

Do old studies need re-indexing after a tag change?

Yes, studies stored before the change only carry index values for the tags that were configured when they arrived, so new tags do not appear for them automatically. Orthanc provides a way to reprocess stored instances so the index is rebuilt, and the work for a large archive can run for a long time and add load to storage and the database. Plan it as a separate operation with a window, monitoring of disk and database use, a rollback plan, and checks that searches return the same results on a sample. Confirm the exact procedure for your Orthanc version in the official Orthanc Book before scheduling it, because behavior can differ between releases.

Which sequence and tag limits affect search results?

Tags inside DICOM sequences are not indexed the same way as top-level attributes, and the sequence depth and item limits decide which values are visible to search. Engineers should test sequence-based tags with real files from each modality, because a value that appears in one vendor's export may sit in a different nesting level in another. Document the limit settings you rely on and confirm them against the version you run. Searches that return fewer results than expected are often caused by these structural differences rather than by a missing tag entry.

Is a consultant worth paying for this kind of change?

A consultant is worth considering when the archive is large, the change touches production search for clinical users, or the internal team has no test instance and no time to build verification. The value comes from a written scope, a tested change set, a documented rollback and a retest after the re-index. Cost components include planning, environment preparation, configuration, verification and handover, and most of these are one-time. Recurring costs appear only if you add support or a retainer. Ask for a written scope that names the deliverables, the assumptions about archive size and database engine, the responsibilities of each party, and the acceptance tests.

What should a written scope for this work include?

A useful scope lists the tags being added or removed, the reason for each based on real queries, the database engine and Orthanc version in use, the archive size and growth expectations, and the sample studies used for testing. It should also describe the re-index approach, the maintenance window, monitoring during the change, the rollback steps, and the search results that count as passing. Finally, it should state who performs each task, what documentation is delivered, and whether any ongoing support is included. Vague scopes tend to produce disputes about what was finished.

Limits to confirm for your Orthanc version and environment

Tag indexing changes depend on the Orthanc release in use, the database back end and the clients that send searches. The cards below list the points to confirm in your own environment before you change the MainDicomTags configuration or rely on the faster search results in production.

MainDicomTags behavior in your release

Confirm how the default MainDicomTags list and ExtraMainDicomTags are indexed in the Orthanc release you run. Orthanc 1.13.0 was released on 2026-08-15 with a complete rewrite of storage-area access and DICOM parsing, so read its release notes before assuming that earlier indexing behavior still applies. Check whether existing studies need re-indexing after any change to the list.

Orthanc NEWS file

SQLite index limits at scale

The built-in SQLite index is the first thing to reconsider as the archive grows. The Orthanc documentation says it should be replaced by an enterprise database engine once the archive holds several hundred thousand DICOM instances, and it recommends the PostgreSQL plugin for large datasets. Measure search latency on a copy of your real archive before and after adding tags, not on a small test set.

Instances before migrating
Several hundred thousand
Scalability FAQ

Sequence handling limits

Confirm how the configuration reference treats DICOM sequences when an extra tag sits inside a sequence. Some tags are only reachable through nested items, and the handling of repeated or deep sequence elements may differ from what your modalities send. Test each sequence-based tag with real sample instances from your modalities and confirm that the expected values are indexed and returned.

Plugin compatibility with your database back end

Confirm that every plugin in your stack supports the database back end you choose, including the PostgreSQL, MySQL/MariaDB, ODBC and cloud storage plugins. Plugin versions must match the core release, and a change to indexed tags can interact with plugin behavior. Keep a tested pairing of core, plugin and database versions and record it before any change.

Orthanc plugins page

Client and viewer search dependencies

Identify which clients, viewers and integrations send C-FIND or REST searches, and which fields they rely on. A new indexed tag can change result ordering, match behavior or response size for existing queries. Ask each application owner to run their standard search workflows against a staging instance before the change goes live.

How DeployOpen works on this

DeployOpen scopes MainDicomTags changes against the searches your teams actually run, then builds and tests the configuration in a staging copy of your Orthanc before anything touches production. The work is delivered as a fixed-scope engagement with written deliverables, so the tag list, the reindex plan and the verification results are agreed before work starts.

How we scope

  • We list the C-FIND and REST queries your PACS, viewers and scripts send, and note which DICOM tags they filter on.
  • We confirm the Orthanc version and database plugin in use, since indexing behavior and reindex options depend on them.
  • The written scope names the extra tags, sequence handling decisions, and the existing studies that must be updated.

How we build

  • We edit ExtraMainDicomTags in a test environment and record the configuration as a version-controlled file.
  • We run representative searches before and after the change, comparing results and response times on a copy of your data.
  • We check that new tags do not break existing queries, scripts or the Orthanc Explorer 2 search views you depend on.

How we hand over

  • You receive the final configuration file, a list of indexed tags with the reason for each, and the reindexing steps used.
  • The handover includes a runbook for adding a tag later, including how to update studies already stored in Orthanc.
  • We document the verification queries so your own team can repeat the comparison after future Orthanc upgrades.

How we support

  • Support after handover is available as a retainer that covers configuration reviews when your query patterns change.
  • Retainers can also cover retesting the tag configuration when you plan an Orthanc core or plugin upgrade.
  • Changes that alter the indexed tag set are agreed in writing with you before they are applied to a production archive.

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.