The DROP INDEX statement allows you to drop a named primary or secondary index. You can drop unnamed primary indexes using the DROP PRIMARY INDEX statement.
DROP INDEX named_keyspace_ref.index_name [USING GSI | VIEW];
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
For example, main:customer indicates the customer keyspace in the main namespace. 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.
When using memory-optimized indexes, DROP INDEX is an expensive operation and may take a few minutes to complete.
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";