Cassandra supports CONTAINS
on collections:
CREATE TABLE contacts (
id int PRIMARY KEY,
firstName text,
lastName text,
phones map<text, text>,
emails set<text>
);
CREATE INDEX ON contacts (firstName);
CREATE INDEX ON contacts (keys(phones)); // Using the keys function to index the map keys
CREATE INDEX ON contacts (emails);
And it is possible to query the emails
set and check for specific Email. Simply:
SELECT * FROM contacts WHERE emails CONTAINS '[email protected]';
What would be the solution if one wants to check for lack of an element, something like: DOES NOT CONTAIN
? I couldn't find such functionality in CQL docs, is there any solution for that?