On 28 Nov 2011, at 20:16, suresh chandran wrote:

> May be I can make my statement clear :) I store my devices values in buckets 
> named after OS (say windows/ linux) with the device id's as keys. I want to 
> get  the devices  for a list of device ids . From what I see, the fetch API 
> signature takes in bucket name and key. (Client.fetch("windows", "D1"). Is 
> there a way where I can get Client.fetch("windows", <Collection fo keys>?

There is no multi-fetch from Riak right now. You can either fetch your 
individual keys (serially on in parallel) or run a Map/Reduce. In most case the 
Map/Reduce will be slower (though the API is simpler, I suppose.)

Use IRiakClient.mapReduce().addInput(bucket, key).addInput(bucket, 
key2)…(repeat!) I guess this is ripe for a convenience method that takes (as 
you suggest) addInputs(bucket, Collection<String> keys), so I'll add that to 
the features list.

Or just fetch all your keys using fetch. 

I guess it would be possible to add a bulk fetch API to the Riak Java Client 
that spawns a configurable number of threads to fetch a bunch of keys in 
parallel, but right now that is left as an exercise for the reader :)

Cheers

Russell


> 
> Thanks
> Suresh C Nair
> From: suresh chandran <[email protected]>
> To: "[email protected]" <[email protected]> 
> Sent: Monday, November 28, 2011 2:53 PM
> Subject: Multiple keys to fetch in a Java client
> 
> HI,
> 
> I am storing values of a devices under a particular OS. I want to fetch the 
> list of all vallues, based on the key list. What I see if that, I can fetch 
> the value one by one using the FETCH. Am using the HttpClient in Java. How do 
> I go about this? Assume I am tryign to reach the same behavior like query 
> that has "CONTAINS(key1, key2...). Is there a way to do this? or we can fetch 
> the values only one by one. I do see that Map-reduce, makes use of the list 
> fo keys, but am not sure if it is applicable in my case, as it ia simple 
> fetch with collection of / list of keys.
> 
> Thanks
> Suresh C Nair
> 
> _______________________________________________
> 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

_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to