This page talks about the primary key of a cassandra table.
The primary key is composed of:
If you’re searching by an attribute, this attribute should be a part of the primary key
Example of a primary with:
CREATE TABLE messages (
channel_id bigint,
bucket int,
message_id bigint,
author_id bigint,
content text,
PRIMARY KEY ((channel_id, bucket), message_id)
) WITH CLUSTERING ORDER BY (message_id DESC);