4

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.

Xavi López
  • 27,550
  • 11
  • 97
  • 161
Rups N
  • 417
  • 1
  • 5
  • 15

2 Answers2

4

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.

rs_atl
  • 8,935
  • 1
  • 23
  • 28
  • How would I achieve to read data if "the 5856869 portion of the key would have to be the first part ". Currently I am using Astyanax. I doubt Astyanax supports it. Could it done by Hector and how ? Thanks in advance for prompt response. – Rups N Dec 17 '12 at 03:30
  • The article I referenced above goes into detail on how to do this with Astyanax. – rs_atl Dec 17 '12 at 14:43
0

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

Community
  • 1
  • 1
Maciej Miklas
  • 3,305
  • 4
  • 27
  • 52