Storing schema-less complex json object in Cassandra -
i have schema-less json object wish store in cassandra db using spring-cassandra. learned cassandra supports map type cassandra doesn't accept map<string, object>
data model.
i need query on fields of json storing blob out of question. there anyway can this?
ps: i've looked @ storing json object in cassandra, answer didn't seem applicable use case json complex.
did @ udt (user-defined-type) ?
you can define udt this:
create type my_json( property1 text, property2 int, property3 map<text, text>, property4 map<int, another_json_type>, ... )
and in java use map<string, usertype>
note: usertype
comes java driver: https://github.com/datastax/java-driver/blob/2.1/driver-core/src/main/java/com/datastax/driver/core/usertype.java
you cannot create user type n java, can metadata of table, see this: https://github.com/datastax/java-driver/blob/3.0/driver-core/src/test/java/com/datastax/driver/core/usertypestest.java#l62-l81
Comments
Post a Comment