The text below represents the complete specification of the search query DSL (Domain Specific Language) used in text queries. See also Search operation table, Search flow.
Before a query is parsed, each alias reference in the query is replaced with the text associated with the alias in the alias dictionary of the index. An alias reference has the following syntax:
alias-reference:
@alias-name
alias-name:
One or more characters from the ranges a-z and 0-9
An alias reference is replaced only if it is preceded by the beginning of the query, a space or an opening parenthesis, and is followed by a space, a closing parenthesis or the end of the query. For details, see the Using aliases page.
The syntax of a query after alias substitution is as follows.
query:
regex-query
non-regex-query
regex-query:
^pattern
non-regex-query:
unary-query
binary-query
unary-query:
word
word-pattern (since v.18.12)
phrase-query
field-name-query
numeric-range-query
date-range-query
parenthesized-query
not-query
phrase-query:
" phrase-item-list "
phrase-item-list:
phrase-item phrase-item
phrase-item-list phrase-item
phrase-item:
word
word-pattern (since v.18.12)
wildcard (since v.18.1)
word:
any word without special characters
word-pattern (since v.18.12)
any non-special characters
? (question marks)
?(n~m) (Wildcard groups, where n is byte-number, m is byte-number, and n <= m. For example: ?(1~2) )
wildcard: (since v.18.1)
* byte-number
* byte-number ~~ byte-number
byte-number: (since v.18.1)
Any integer number in the range from 0 to 255
field-name-query:
field-name: unary-query
numeric-range-query:
number ~~ number
number:
Any non-negative integer number
date-range-query:
daterange( date ~~ date )
date:
A date in the format 'yyyy-MM-dd'. For example: 2019-09-16
parenthesized-query:
( non-regex-query )
not-query:
! unary-query
NOT unary-query
binary-query:
and-query
or-query
and-query:
non-regex-query & unary-query
non-regex-query AND unary-query
or-query:
non-regex-query | unary-query
non-regex-query || unary-query
non-regex-query OR unary-query
escape-sequence: (since v.19.2)
\N where N is one of ( ) : " & | ! ^ ~ * ? \ or s (for space character)
\uhhhh where h is hexadecimal digit (for any Unicode character)
More resources
GitHub examples
You may easily run the code from documentation articles and see the features in action in our GitHub examples: