Query DSL
Domain Specific Language for document search
Invariant Content Insight uses Elasticsearch engine for storage and the content search module makes use of Elasticsearch Query DSL
The query string (search_text parameter) passed to the engine is parsed into a series of terms and operators. A term can be a single word — tasty or chicken — or a phrase, surrounded by double quotes — "tasty chicken" — which searches for all the words in the phrase, in the same order.
The search can be customized using operators listed below.
Wildcards
Wildcard searches can be run on individual terms, using ?
to replace a single character, and *
to replace zero or more characters. Wildcard searches are not efficient and their use should be limited.
Boolean operators
By default, all terms are optional, as long as one term matches. A search for fish frog turtle
will find any document that contains one or more of fish
or frog
or turtle
. There are also boolean operators which can be used in the query string itself to provide more control.
The preferred operators are +
(this term must be present) and -
(this term must not be present). All other terms are optional.
For example, in the following query:
The familiar operators AND
, OR
and NOT
(also written &&
, ||
and !
) are also supported. However, you have to keep the precedence in mind when using these. NOT
takes precedence over AND
, which takes precedence over OR
.
The operators +
and -
only affect the term to the right of the operator. AND
and OR
operators can affect the terms to the left and right.
Grouping
Multiple terms or clauses can be grouped together with parentheses to form sub-queries:
Last updated