A newer version of this documentation is available.

View Latest



    The DROP INDEX statement allows you to drop a named primary or secondary index, dropping an index that has replicas will also drop all of the replica indexes too. You can drop unnamed primary indexes using the DROP PRIMARY INDEX statement.


     DROP INDEX named_keyspace_ref.index_name
     [USING GSI];


    index name is a unique name that is provided to identify the index.


    [ namespace-name :] keyspace-name


    identifier that refers to the bucket name. Specifies the bucket as source for which the index needs to be created. You can add an optional namespace name to the keyspace name in this way:

    namespace-name : keyspace-name

    Currently, only the default namespace is available. For example, default:`travel-sample` indicates the travel-sample keyspace in the default namespace. If the namespace name is omitted, the default namespace in the current session is used.


    In Couchbase Server 6.5 and later, the index type for a secondary index must be Global Secondary Index (GSI). The USING GSI keywords are optional and may be omitted.

    When using memory-optimized indexes, DROP INDEX is an expensive operation and may take a few minutes to complete.

    We recommend that you do not drop (or create) secondary indexes when any node with a secondary index role is down as this may result in duplicate index names.

    RBAC Privileges

    User executing the DROP INDEX statement must have the Query Manage Index privilege granted on the keyspace/bucket. For more details about user roles, see Authorization.


    Example below creates a secondary index on the beer-sample bucket. Once the index creation statement comes back, system:indexes is queried for status of the index.

    CREATE INDEX `beer-sample-type-index` ON `beer-sample`(type) USING GSI;
    SELECT * FROM system:indexes WHERE name="beer-sample-type-index";

    Subsequently, the index is dropped with the following statement and it no longer is reported in the system:indexes output.

    DROP INDEX `beer-sample`.`beer-sample-type-index` USING GSI;
    SELECT * FROM system:indexes WHERE name="beer-sample-type-index";