A newer version of this documentation is available.

View Latest

Reserved Words

N1QL defines an extensive list of keywords that are reserved words. You cannot use these keywords as identifiers unless you escape them. All of the N1QL keywords are case insensitive.

Some of the keywords are not currently implemented but are reserved for future use.

Using Reserved Words as Identifiers

N1QL allows escaped identifiers to overlap with keywords. To use a reserved word as an identifier, you must escape it by enclosing the reserved word inside backticks (`). For example, if your JSON document contains a field named `index, you can use it in your queries by escaping it like this:

{
    "age": "42",
    "index": 27,
    "name": "Elvis"
}
CREATE INDEX myindex ON default(`index`) USING GSI;

N1QL Reserved Words

The following keywords are reserved and cannot be used as unescaped identifiers:

ALL

ALTER

ANALYZE

AND

ANY

ARRAY

AS

ASC

BEGIN

BETWEEN

BINARY

BOOLEAN

BREAK

BUCKET

BUILD

BY

CALL

CASE

CAST

CLUSTER

COLLATE

COLLECTION

COMMIT

CONNECT

CONTINUE

CORRELATE

COVER

CREATE

DATABASE

DATASET

DATASTORE

DECLARE

DECREMENT

DELETE

DERIVED

DESC

DESCRIBE

DISTINCT

DO

DROP

EACH

ELEMENT

ELSE

END

EVERY

EXCEPT

EXCLUDE

EXECUTE

EXISTS

EXPLAIN

FALSE

FETCH

FIRST

FLATTEN

FOR

FORCE

FROM

FUNCTION

GRANT

GROUP

GSI

HAVING

IF

IGNORE

ILIKE

IN

INCLUDE

INCREMENT

INDEX

INFER

INLINE

INNER

INSERT

INTERSECT

INTO

IS

JOIN

KEY

KEYS

KEYSPACE

KNOWN

LAST

LEFT

LET

LETTING

LIKE

LIMIT

LSM

MAP

MAPPING

MATCHED

MATERIALIZED

MERGE

MINUS

MISSING

NAMESPACE

NEST

NOT

NULL

NUMBER

OBJECT

OFFSET

ON

OPTION

OR

ORDER

OUTER

OVER

PARSE

PARTITION

PASSWORD

PATH

POOL

PREPARE

PRIMARY

PRIVATE

PRIVILEGE

PROCEDURE

PUBLIC

RAW

REALM

REDUCE

RENAME

RETURN

RETURNING

REVOKE

RIGHT

ROLE

ROLLBACK

SATISFIES

SCHEMA

SELECT

SELF

SEMI

SET

SHOW

SOME

START

STATISTICS

STRING

SYSTEM

THEN

TO

TRANSACTION

TRIGGER

TRUE

TRUNCATE

UNDER

UNION

UNIQUE

UNKNOWN

UNNEST

UNSET

UPDATE

UPSERT

USE

USER

USING

VALIDATE

VALUE

VALUED

VALUES

VIA

VIEW

WHEN

WHERE

WHILE

WITH