NoSQL Zone is brought to you in partnership with:

Brian has 10+ years of experience as a technology leader and architect in a wide variety of settings from early startups to Fortune 500 companies. With experience delivering SaaS solutions in business intelligence, artificial intelligence and VoIP, his current focus is big data and analytics. Brian leads the Virgil project on Apache Extras, which is a services layer built on Cassandra that provides REST, Map/Reduce, Search and Distributed Processing capabilities. Brian is a DZone MVB and is not an employee of DZone and has posted 62 posts at DZone. You can read more from them at their website. View Full User Profile

Indexing JSON in Cassandra

07.05.2012
| 4646 views |
  • submit to reddit

Cassandra has native indexing capabilities, but those capabilities only work if the values stored in your columns are the values you want indexed.  If the data is structured in some way (e.g. JSON or Protobuf), it is impossible to leverage Cassandra's indexing capabilities out of the box.

A while back we had a discussion on the dev list regarding indexing attributes stored in columns in Cassandra.  I think Jermiah Jordan had the best description of the problem.  Lately, we found ourselves with the same problem so we ended up building it into our cassandra-indexing extension.

Our cassandra-indexing module, is an AOP-based extension to Cassandra.  Drop the jar file in the Cassandra lib directory, update the start script to include the extension and the aspect will take care of indexing information as you mutate the data in Cassandra.

To support indexing a specific field within the column value, we added the ability for a user to specify a field to index (not just a column name).  We then parse the JSON document as it is written in the mutation, extract the values and create entries in the wide-row index for that column family.

Specifics for the new JSON-based indexing configuration can be found on the wiki.  Admittedly, we are still light on documentation.  If you have any trouble using the new capability, let us know.
Published at DZone with permission of Brian O' Neill, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)