A newer version of this documentation is available.

View Latest


An identifier is a symbolic reference to a value in the current context of a query. Identifiers can include keyspace names, fields within documents, and aliases. N1QL identifiers are case sensitive.

An identifier can either be escaped or unescaped.

unescaped-identifier | escaped-identifier


If the current context is the document:

{"name": "n1ql"}

Then the identifier name would evaluate to the value n1ql.

Unescaped Identifiers

Unescaped identifiers cannot support the full range of identifiers allowed in a JSON document, but do support the most common ones with a simpler syntax.

[a-zA-Z_] ( [0-9a-zA-Z_$] )*

Escaped Identifiers

Escaped identifiers are surrounded by backticks and support all identifiers in JSON. You can use the backtick character within an escaped identifier by specifying two consecutive backtick characters. Keywords cannot be escaped; therefore, escaped identifiers can overlap with keywords.

` characters `

For example, if you have a hyphen in an attribute name, it can be referred to as first-name.