Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6180735
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:53:48+00:00 2026-05-24T00:53:48+00:00

i am starting with cassandra, but i have some difficult to understand how the

  • 0

i am starting with cassandra, but i have some difficult to understand how the queries work.

i have this

[default@Keyspace1] get Users[jsmith];                    
=> (column=adress, value=London, timestamp=1311087089506000)
=> (column=age, value=*, timestamp=1311086896514000)
=> (column=first, value=John, timestamp=1311086884652000)
=> (column=last, value=Smith, timestamp=1311086891619000)
Returned 4 results.

In SQL i can do: SELECT last FROM Keyspace1 WHERE first="John"

But in cassandra language?

I am trying something like this, but i confess that i’m totally confused about the sintax.

[default@Keyspace1] keyspace1.get("column_family","John","last")
... 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T00:53:48+00:00Added an answer on May 24, 2026 at 12:53 am
    [default@stackoverflow] set Users['jsmith']['address']=London;
    Value inserted.
    [default@stackoverflow] set Users['jsmith']['age']=42;
    Value inserted.
    [default@stackoverflow] set Users['jsmith']['first']=john;
    Value inserted.
    [default@stackoverflow] set Users['jsmith']['last']=smith;
    Value inserted.
    [default@stackoverflow] get Users['jsmith']['last'];
    => (column=last, value=smith, timestamp=1311090805707000)
    

    But, you have to know row-key for this. It will be hard to do this kind of search; look at this thread, they discuss the same.


    Update (thanks @jbellis for the hint)

    It seem that there are quite a few things added in Cassandra 0.7 and newer releases. I have been working on 0.6. So, yes, you can do it.

    In Cassandra 0.7 you can

    [default@unknown] connect localhost/9160;
    Connected to: "Test Cluster" on localhost/9160
    [default@unknown] use stackoverflow;
    [default@stackoverflow] create column family IndexedUsers with 
    comparator=UTF8Type and column_metadata=[
    {column_name:address, validation_class:UTF8Type}, 
    {column_name:age, validation_class:UTF8Type}, 
    {column_name:first, validation_class:UTF8Type, index_type:KEYS}, 
    {column_name:last, validation_class:UTF8Type}];
    79d6ebce-b279-11e0-9ddf-e700f669bcfc
    Waiting for schema agreement...
    ... schemas agree across the cluster
    [default@stackoverflow] set IndexedUsers['jsmith']['age']=42;
    Value inserted.
    [default@stackoverflow] set IndexedUsers['jsmith']['address']='London';
    Value inserted.
    [default@stackoverflow] set IndexedUsers['jsmith']['first']='John';
    Value inserted.
    [default@stackoverflow] set IndexedUsers['jsmith']['last']='Smith';
    Value inserted.
    [default@stackoverflow] get IndexedUsers where first='John';
    -------------------
    RowKey: jsmith
    => (column=address, value=London, timestamp=1311129646984000)
    => (column=age, value=42, timestamp=1311129627578000)
    => (column=first, value=John, timestamp=1311129676977000)
    => (column=last, value=Smith, timestamp=1311129698125000)
    
    1 Row Returned.
    

    But not

    [default@stackoverflow] get IndexedUsers[last] where first='John';
    Syntax error at position 23: missing EOF at 'where'
    

    because:

    [default@stackoverflow] help get;
    get <cf>['<key>'];
    get <cf>['<key>']['<col>'] (as <type>)*;
    get <cf>['<key>']['<super>'];
    get <cf>['<key>'][<function>];
    get <cf>['<key>'][<function>(<super>)][<function>(<col>)];
    get <cf> where <column> = <value> [and <column> > <value> and ...] [limit <integer>];
    Default LIMIT is 100. Available operations: =, >, >=, <, <=
    

    CQL is a better option here it seems. It’s a part of Cassandra 0.8 release. Refer this. There you can:

    CREATE INDEX [index_name] ON <column_family> (column_name);
    

    and then

    SELECT [FIRST N] [REVERSED]  col_name1, col_name2 FROM <COLUMN FAMILY> 
    [USING <CONSISTENCY>] [WHERE <CLAUSE>] [LIMIT N];
    

    Refer complete CQL commands here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Starting a project, and this irriating me. I think the code is okay, but
starting with priority_queue s, I have a problem like this: I need elements to
Starting a new GWT application and wondering if I can get some advice from
Starting this morning my Eclipse indigo have projects and files with gray light color.
I am trying to run sstable2json utility after starting cassandra server but it throwing
Starting with a default install of Symfony2, I logged an INFO-level message using this
Starting on my first Metro App and I'm hating this Async crap. I have
Starting out with php, I have written a basic authentication script which prints out
I have 6 nodes in my cassandra cluster. Now I have upgraded cluster from
As per this article , I could generate tokens, configured Cassandra.yaml on both machines

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.