首页 > 解决方案 > 使用 Stargate API 从 DSE 集群读取数据时出错

问题描述

由于在 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"}}

标签: cassandracqldatastax-enterprisestargate-ossdatastax-astra

解决方案


您可以尝试使用 status!='PROCESSED' 和 status_code!='400' 和 attemp_count<8

由于 status_code 是一个字符串,因此您将需要引号。


推荐阅读