cassandra - 使用 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"}}
解决方案
您可以尝试使用 status!='PROCESSED' 和 status_code!='400' 和 attemp_count<8
由于 status_code 是一个字符串,因此您将需要引号。
推荐阅读
- ruby-on-rails - 为什么我得到:使用邀请的 Hash:Class 的未定义方法“primary_key”!邀请用户时
- javascript - PHP/HTML5:如何检索用户提交的表单?
- python - 如果满足条件,则列出理解以更新值
- python - Python - 绘制一个基本函数
- python - 评估期间的舍入运算
- java - Cordova:在不更改环境变量的情况下指定要使用的 java 路径
- javascript - 循环中声明的函数包含对变量的不安全引用
- php - php/mysql 到 ChartJS 雷达图 - 将数据正确传递给 ChartJS
- python - 如何检测 reddit 帖子是否包含图像?
- sql - 为列中的值获取长度为 1 或 2 的子字符串并在输出中放入单列?