Cassandra querying on a part of a key

喜夏-厌秋 提交于 2019-12-01 05:16:53

问题


I have a cassandra column family which has a row key like 2012-09-30-05-42-00:30:5856869

I need to query some thing like

select * from cf where key like %5856869%

Currently I am using Astyanax , is same possible in astyanax. If not, which implementation would support it.


回答1:


LIKE queries are not supported in Cassandra. If you want to query based on part of a key, you'll want to use composite keys. But in this specific case, the 5856869 portion of the key would have to be the first part for you to do what you want. Remember that with Cassandra, you must write your data the way you expect to read it.




回答2:


None.... you need to write index manually - this is how you handle such things in Cassandra, or you might try full text search: Cassandra full text search like



来源:https://stackoverflow.com/questions/13857471/cassandra-querying-on-a-part-of-a-key

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!