DROP PRIMARY INDEX
The DROP PRIMARY INDEX statement allows you to drop an unnamed primary indexes.
|Named primary indexes that are created using CREATE PRIMARY INDEX, can only be dropped using the DROP INDEX command.|
DROP PRIMARY INDEX ON named_keyspace_ref [USING GSI|VIEW];
[ 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.
default:`travel-sample` indicates the
travel-sample keyspace in the
If the namespace name is omitted, the default namespace in the current session is used.
USING GSI | VIEW
USING clause specify the index type to use. Indexes can be created using GSI or views. If USING clause is not specified, by default GSI is used as the indexer.
(Note that USING VIEW is deprecated and will be removed in a future release.)
User executing the DROP PRIMARY INDEX statement must have the Query Manage Index privilege granted on the keyspace/bucket. For more details about user roles, see Roles.
The following example creates a primary index on the beer-sample bucket. Once the index creation statement comes back, system:indexes is queried for status of the index.
CREATE PRIMARY INDEX ON `beer-sample` USING GSI; SELECT * FROM system:indexes;
Subsequently, the unnamed primary index is dropped with the following statement and it no longer is reported in the system:indexes output.
DROP PRIMARY INDEX ON `beer-sample` USING GSI; SELECT * FROM system:indexes;