从Cassandra列表集合中选择索引

从Cassandra列表集合中选择索引

问题描述:

我很好奇,如果可以从Cassandra中的列表集合中选择特定的索引。说我有:

I was curious if it's possible to SELECT a specific index from a list collection in Cassandra. Say I have:

CREATE TABLE users (
  user_id text PRIMARY KEY,
  order_list list<text>
);

UPDATE users
   SET ordered_list = [ 'thing1', 'thing2', 'thing3' ] WHERE user_id = 'user1';

可以从CQL获取ordered_list的索引,例如ordered_list [1]查询而不是整个列表?

Is it possible to then get back an index of ordered_list, such as ordered_list[1] from a CQL query instead of the entire list?

不,你不能。您可以使用下标 UPDATE DELETE ,但不能 SELECT INSERT

No, you can't. You can UPDATE and DELETE with subscripts, but not SELECT or INSERT.