2016-08-04 65 views
0

我已經創建了一個表'test',並使用下面的命令使用CQL插入了一些值。Cassandra在地圖字段中使用IN命令選擇查詢

create table testt(val map<text,text>, id text primary key); insert into testt (val,id) values ({'key':'1'},'1');

當我檢索使用下面的查詢它的工作原理

select * from testt where val['key']='1' allow filtering;

我需要檢索所有包含VAL [ 鍵']值倍數值。使用下面的命令拋出錯誤。

select * from testt where val['key'] IN('1') allow filtering;

SyntaxException: <ErrorMessage code=2000 [Syntax error in CQL query] message="line 1:37 no viable alternative at input 'IN' (... testt where val['key'] [IN]...)">

是否有可用的任何其他方式或方法,獲得所需的輸出?

+0

你好。有什麼需要?在收藏上搜索是非常複雜的。您可以使用其他模型更容易地搜索所需的值。例如使用一個搜索表。 –

回答

0

您可以在Cassandra中檢索多個鍵的唯一方法是執行多個查詢。您可能可以調整主鍵以適應用單個查詢獲取所需的值。

相關問題