Search Expressions and Syntax (BETA)
Please try this BETA API and let us know what you think.
If you are looking for information about clinical studies, please visit ClinicalTrials.gov.

Search Expressions and Syntax

Search Syntax

Search syntax refers to the arrangement of search terms and operators in search expressions used for evaluation by the search engine.

Search Expression

A search expression consists of sequences of search terms and operators that are evaluated by the search engine to find lists of studies. The search operators affect which studies are returned by the search and their rank order in retrieval sets by changing how the search terms are contextualized or interpreted.

All search expressions are OR expressions.

Search Terms

Search terms are words or phrases that must appear as values in the study records returned by the search. A search term consists of a string of characters without embedded search operators. Enclosing a multi-word term in quotation marks indicates that all of the words in the search term must be found together in that order (that is, as a phrase) for a study record to be retrieved by the search (see below).

ClinicalTrials.gov API Search Term

To search for an operator as part of a term, add a backslash before the operator (e.g., \MISSING). If the operator used is quotation marks, then only embedded quotes need to be preceded by a backslash (e.g., \"sleep deprivation\").

OR Expression

An OR expression consists of a list of one or more AND expressions (such as a search term or phrase) separated by binary Boolean OR operators (see below).

ClinicalTrials.gov API OR Expression

The following examples are all OR expressions that include AND expressions:

  • heart attack
  • heart attack OR stroke
  • heart attack OR stroke OR dizziness AND shortness of breath

The OR operator has the lowest precedence among search operators. All AND expressions are evaluated before the OR expressions formed by connecting the AND expressions using OR operators.

AND Expression

An AND expression consists of a list of one or more operator expressions, separated by zero, one, or many binary Boolean AND operators (see below).

ClinicalTrials.gov API AND Expression

The following examples are all AND expressions that include operator expressions:

  • dizziness
  • dizziness AND NOT exhaustion
  • dizziness AND NOT exhaustion AND stroke

The AND operator has the second lowest precedence among search operators. All operator expressions are evaluated before the AND expressions formed by connecting the operator expressions using AND operators.

Operator Expression

An operator expression consists of a sequence of zero, one, or more unary operators (e.g., the NOT operator and all context operators), followed by a source expression. Any number of operator expressions may precede a source expression (see below).

ClinicalTrials.gov API Operator Expression

The TILT and AREA operators take search areas (labeled "Area" in the figure above) as a parameter. Note that the parameter is enclosed in square brackets, and there is no space bewtween the operator and the left bracket.

The SEARCH operator takes either "Study" or "Location" as a parameter, as show in the figure above.

The COVERAGE and EXPANSION operators take one of a small set of choices as a parameter (shown in the figure above).

The following examples are all operator expressions that include source expressions:

  • exhaustion
  • NOT exhaustion
  • EXPANSION[Concept] NOT (exhaustion OR sleep deprivation)
  • heart attack AND SEARCH[Location](AREA[LocationCity] Bethesda AND AREA[LocationState] Maryland)

These unary operators have the second highest precedence after source expressions.

Source Expression

A source expression consists of a search term, a range expression, an OR expression enclosed in parentheses, and either the MISSING or ALL source operator (see below).

ClinicalTrials.gov API Source Expression

The following examples are all source expressions:

  • exhaustion
  • RANGE[21 years,MAX]
  • (exhaustion OR sleep deprivation)
  • MISSING

Range Expression

A range expression consists of a RANGE operator with minimum and maximum values as parameters. Use MIN to indicate the smallest value of interest in the search area, and use MAX to indicate the largest value of interest in the search area (see below).

ClinicalTrials.gov API Range Expression

Studies with no values in the search area will not be retrieved by a search that uses a range expression.

Order of Precedence Among Expressions

The order in which different types of search expressions are evaluated by the search engine is presented below. To increase the precedence of an expression, enclose that expression in parentheses.

  1. Source expression
  2. Operator expression
  3. AND expression
  4. OR expression
This page last reviewed in September 2019