The CREATE INDEX command is used to create an index in the Cassandra table. In this lesson, I will show you how to create and drop index in Cassandra.
Note: You can't create an index on PRIMARY KEY because the primary key is already an index. Cassandra can't filter a column without indexing.
Syntax:
CREATE INDEX index_identifier ON table_info
Example:
CREATE INDEX emploayee_name_index ON employees (name) ;
Syntax:
DROP INDEX index_identifier
Example:
DROP INDEX emploayee_name_index;