Carl, There is currently no GROUP BY or aggregate function support for Riak indexes. I think range query fed into map/reduce is a good option. Another option is to run a 2i term query for each flavor. Although, I would make sure to measure both. Also, since you are storing the histogram in a meta-object that the application will read you don't have to worry about the query runtime affecting your application directly.
-Ryan On Wed, Feb 1, 2012 at 5:23 PM, Carl <[email protected]> wrote: > I have a bucket containing about 1,000 records. These records are > indexed on a property let's call "flavor". There are only about 10 > different flavors. > > Is there a way I could query the flavor_bin index to discover what these > unique values are? The brute-force method would be a map-reduce doing a > range query on 'flavor_bin' from 'AAAA' to 'zzzz' and then boiling that > down to the unique values in the reduce phase. But that would have to > retrieve every record in the bucket. > > Is there some meta-data about the index I could query more efficiently > to do this? > > This is not something I would need to do very often, and I would store > the resulting list in one record for actual use by the application. > > _______________________________________________ > riak-users mailing list > [email protected] > http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com >
_______________________________________________ riak-users mailing list [email protected] http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
