【发布时间】:2021-11-26 20:43:59
【问题描述】:
由于在 Talend 中使用 cassandra 时出现一些技术问题,我们正在使用 stargate api 将数据读取和写入 DSE Cassandra。我不得不说,我对 cassandra 甚至 NoSql 世界都是全新的。
我有几个字段,status(text)、status_code(text) 和 attemp_count(int)。现在我需要从 Cassandra 读取具有以下条件的数据。
条件:
status!='PROCESSED' and status_code!=400 and attemp_count<8
下面是我的桌子设计的样子。
下面是我遇到的错误。
列“status_code”有索引,但不支持查询中指定的运算符。如果您想在性能不可预测的情况下执行此查询,请使用 ALLOW FILTERING
{
"description": **"Bad request: org.apache.cassandra.stargate.exceptions.InvalidRequestException:** Column 'status_code' has an index but does not support the operators specified in the query. If you want to execute this query despite the performance unpredictability, use ALLOW FILTERING",
"code": 400
}
我用来做一个简单测试的查询:
{{url}}/v2/keyspaces/dco/mc_inbound_log?where={"status_code":{"$gt":"201"}}
【问题讨论】:
-
这看起来更像是一个数据建模问题,而不是星际之门特定的问题。由于不支持对二级索引的范围查询,因此使用 CQL 会出现相同的错误。
标签: cassandra cql datastax-enterprise stargate-oss datastax-astra