0
votes

I would like to find out if I can insert nested level JSON document directly into cassandra Column family using any of the collection based data type(map,list..etc)? Any examples would be greatly appreciated.

Thanks, HDB

1
Can you share what you have tried so far? I would suggest taking a look at the help center to post enough details to make sure you get the answer you're searching for.PhilDulac
Hi PhilDulac, I have tried inserting the entire JSON document into one column of text data type whcih worked fine for me. However, my JSON has a nested level array of elements which I need to run a search query against. I can keep them as separate attributes and index them as per the need. What I am wondering here is, Can we leverage any of these collection types to handle the JSON. I will look at help center and post more details there. Thanks, HDBHDB

1 Answers

0
votes

As you correctly wrote in your comment you can extract 'searchable' fields from the JSON and put them in separate, indexed columns. You can also try to map more fields from the JSON, convert them to a flat object and construct a map, which also can be indexed. More here:

CQL for Cassandra 2.0 & 2.1: Indexing a collection

Please note, however:

Indexes on the keys and values of a map cannot co-exist.

Therefore - as always in Cassandra - you have to design your model based on needed queries.

However, if you are only researching possible solutions, I suggest you taking a look on ElasticSearch, which might be a better choice in this case.