Search Syntax

Searching The Lens can be done simply by using the search bar or the Structured Search page. After your initial search you can refine your parameters using the various faceted filters available to you. However for users who want to go above and beyond with their specificity it is also possible to use native search syntax to create sophisticated searches. Our documentation for this syntax is still a work in progress, but the core information you need to use it can be found below.

Apache Lucene & ElasticSearch – Query Parser Syntax

The Lens uses a modified form of the Apache Lucene and Elasticsearch Query Parser Syntax. For more details on the query syntax used, we highly recommend you read these comprehensive guides on the query syntax’s used here:

Some important notes about the syntax:

  • To search for a value in an indexed field you type the name of the field followed by a colon and then the value you wish to search. For example:
  • When you want to search on multiple fields you can use boolean operators which all must be upper case. For example:
  • Other operators available include:
    • Term grouping: Lucene and Elasticsearch supports using parentheses ( ) to group terms into sub-queries e.g. (red AND yellow) OR (blue and green)
    • Field grouping: Lucene supports using parentheses to group multiple clauses to a single field e.g. title:(car OR truck)
    • * and ? for wildcard searches. Note that wildcard search terms are not stemmed and therefore may not work as expected for searches where “Stemming” (located in “Query Tools“) is turned on. This is because when stemming is turned on, search terms are matched against stemmed values in the index. For example the terms valve and valves will be stemmed to valv and both match the stemmed value valv in the index. The term valve* will not be stemmed and therefore won’t match valv in the index. Read more about stemming on wikipedia.
    • ~ for fuzzy/proximity searches. "foo bar"~4 searches for foo and bar within 4 words from each other. Exact matches are proximity zero and word transpositions (bar foo) are proximity 2.
    • TO for range searches, e.g. date_published:[2020-01-01 TO 2022-12-12]
    • ^ to boost the relevance of a value in a search, affects the result order eg. car AND coke^2
    • \ to escape the following special query syntax characters in a search term that are not inside quotes:
      (+ - && || ! ( ) { } [ ] ^ ~ * ? : \ /)

Note: Searchable text fields are normalised with different filters including the removal of english stop words. The following stop words are ignored in search terms and phrases: a, an, and, are, as, at, be, but, by, for, if, in, into, is, it, no, not, of, on, or, such, that, the, their, then, there, these, they, this, to, was, will, with.

Example Queries

The following are a series of example queries to give you some examples of how the syntax works:

Index Fields

A list of searchable indexed fields is available from the Structured Search page.

Field list available on the Structured Search page.
Updated on February 8, 2024
Was this article helpful?

Related Articles

Need Support?
Can't find the answer you're looking for? Submit a ticket and we'll get you an answer.
Submit Ticket