Query String Queries
Query strings enable humans to describe complex queries using a simple syntax.
Using the query string syntax, the following query types can be performed:
A term without any other syntax is interpreted as a match query for the term in the default field.
The default field is
pool performs a match query for the term
Placing the search terms in quotes performs a match phrase query.
"continental breakfast" performs a match phrase query for the phrase
You can specify the field in which to search by prefixing the term with a field-name, separated by a colon.
The field-name may be a path to a field, using dot notation.
The path must use Search syntax rather than N1QL syntax; in other words, you cannot specify array locations such as
 in the path.
description:pool performs a match query for the term
pool, in the
When a query string includes multiple items, by default these are placed into the SHOULD clause of a boolean query.
You can adjust this by prefixing items with
+places that item in the MUST portion of the boolean query.
-places that item in the MUST NOT portion of the boolean query.
+description:pool -continental breakfast performs a boolean query that MUST satisfy the match query for the term
pool in the
description field, MUST NOT satisfy the match query for the term
continental in the
default field, and SHOULD satisfy the match query for the term
breakfast in the
Result documents satisfying the SHOULD clause score higher than those that do not.
When multiple query-clauses are specified, you can specify the relative importance a given clause by suffixing it with the
^ operator, followed by a number.
description:pool name:pool^5 performs Match Queries for
pool in both the
description fields, but documents having the term in the
name field score higher.
You can specify numeric ranges with the
<= operators, each followed by a numeric value.
reviews.ratings.Cleanliness:>4 performs a numeric range query on the
reviews.ratings.Cleanliness field, for values greater than 4.
You can perform date range searches by using the
<= operators, followed by a date value in quotes.
created:>"2016-09-21" will perform a date range query on the
created field for values after September 21, 2016.
The following quoted string enumerates the characters which may be escaped:
|This list contains the space character.|
In order to escape these characters, they are prefixed with the
\ (backslash) character.
In all cases, using the escaped version produces the character itself and is not interpreted by the lexer.
my\ nameis interpreted as a single argument to a match query with the value "my name".
"contains a\" character"is interpreted as a single argument to a phrase query with the value
contains a " character.