Retrieve all keys of an index?

Shuhao shuhao at shuhaowu.com
Wed Apr 10 01:23:16 EDT 2013


The only way I see is get all the object keys, get all the objects, and 
then merge the secondary index values.

Shuhao

On 13-04-09 09:54 PM, Jeff Peck wrote:
> Hello,
>
> In Riak, is it possible to retrieve all of the keys of an index? I do not want the object keys in this case, but rather the actual index keys.
>
> I am not sure that I am using the correct terminology, but to illustrate, consider a Riak bucket with the following objects, where "catalog" is indexed to "catalog_bin":
>
> {'url':'http://www.google.com', 'catalog':'1001'}
> {'url':'http://www.yahoo.com', 'catalog':'1001'}
> {'url':'http://www.blah.com', 'catalog': 1002'}
> {'url':'http://www.test123.com', 'catalog': 1002'}
> {'url':'http://www.test12345.com', 'catalog': 1003'}
>
> I would like to retrieve all of the keys for the index catalog_bin. From the above example, that would be:
> 1001
> 1002
> 1003
>
> To illustrate further, it would be the equivalent of the following in MySQL, if the above data were to be in a table called "urls":
>
> 	SELECT catalog FROM urls GROUP BY catalog;
>
> I would appreciate any advice as to how to query for this in Riak, or if this not feasible, then perhaps a suggestion for the best way to organize the data.
>
> Thank you,
> Jeff
>
>
>
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>




More information about the riak-users mailing list