是否可以在select语句Cassandra中的where子句之后传递任何其他列

是否可以在select语句Cassandra中的where子句之后传递任何其他列,select,primary-key,cassandra,where,cql,Select,Primary Key,Cassandra,Where,Cql,我一直在尝试使用以下命令从Cassandra数据库检索数据: select A_NO from Activity where CALL_TYPE IN ('MOC');//here CALL_TYPE is not the row id 但它表明: Expected key 'KEY' to be present in where clause for 'Activity' 在cassandra中,是否不可能使用非主键过滤数据 不能直接在香草柱族上执行此操作。默认情况下,Cassandra

我一直在尝试使用以下命令从Cassandra数据库检索数据:

 select A_NO from Activity where CALL_TYPE IN ('MOC');//here CALL_TYPE is not the row id
但它表明:

Expected key 'KEY' to be present in where clause for 'Activity'

在cassandra中,是否不可能使用非主键过滤数据

不能直接在香草柱族上执行此操作。默认情况下,Cassandra只允许您查询键或键范围。可以通过在列上创建二级索引来实现这一点

您可以像这样运行CQL查询来创建两个索引:

cqlsh> CREATE INDEX state_key ON users (state);
cqlsh> CREATE INDEX birth_year_key ON users (birth_year);
然后像这样查询:

cqlsh> SELECT * FROM users
 ... WHERE gender='f' AND
 ...  state='TX' AND
...  birth_year='1968';


谢谢你,保罗。这真的很有帮助。非常感谢。请确保您将答案标记为已解决,以便其他路过的人知道这是正确的。谢谢