Retrieving objects from Riak

Gianluca Padovani gpadovani at
Wed Jun 15 13:46:21 EDT 2016

Hi all,
I'm exploring RiakKV and RiakTS and I have some questions:

If I need to find a group of objects based on some properties, are there
any way to search it on RiakKV?

For example suppose to have some user and create a key as <state>_<name> so
I have something as:
- TX_John
- TX_May
- CA_Susan
- CA_Martin

Can I find all the people of TX? Can I do something as
users_bucket.get("TX_*") ? I think no.

To manage this scenario one possible way is to use a Crdt::Set. I can
create for every state a set and when I add a new user to users_bucket I
add also in this list. So If I want all users of TX, I get the set of TX,
retrieve all the keys and then get all the objects with a mulit_get.

Another solution is to use 2i, tag every user object with the state, get
the list of the keys and then retrieve the objects always with a multi_get.

Another options is to use riak search that is based on Solr.

Are there any other options? What is the "best options". Some concerns
about that:

In first solution (set) I need to do 2 write for every write and to get the
objects I need to do a get and a multi_get, that I think it's a lot of get,
If I want list it in another way (regarding age for example) I don't have
any options.
Using the 2i I should remember to add the 2i to every objects, If I had
already stored some Object and I want to use a 2i I need to do a map reduce
to retag every obejcts. Probably riak search is the best solution?

If I'll user RiakTS, is this search more simple?

If I use state as Partition Key, I can write

select * from users where state="TX"

but,  when I want search something I always filter for partition key,
I think that RiakTS doesn't support RiakSearch and 2i. Are there some plans
for it?

Is correct use RiakTS without a time series ? :-)

A long mail I know ...

thanks and bye
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the riak-users mailing list