Re: 2i, search or something else for most efficient "range" lookup
Index by endVal and select a range from Value to undefined with max_results=1. ___ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
MapReduce with 2i input filters
Hi Riak users! I'm looking at the sample here: http://docs.basho.com/riak/latest/dev/using/2i/ and wondering if there is a way to use more complicated logic when using 2i input filters to limit the input to a MapReduce function. For example, can I do stuff like "index1_bin in range[1,10] OR in range [21:30]", or "index1_bin in range [1;50] AND index2_bin in range[5;10]" or maybe even "key in range[aaa,zzz] AND index1_bin in range[1,10]" (where key is the actual key from the objects key-value)]? And can I specify if the start/end values should be included? If so, where can I read about this? Thanks, Gints ___ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Re: MapReduce with 2i input filters
I guess it's bit hard to read the 3 samples I asked for, I'll spell them out like this: 1) index1_bin in range[1,10] OR in range [21:30] 2) index1_bin in range [1;50] AND index2_bin in range[5;10] 3) key in range[aaa,zzz] AND index1_bin in range[1,10] (where key is the actual key from the objects key-value) Thanks, Gints On Sat, Aug 24, 2013 at 6:35 PM, Gints Gailītis wrote: > Hi Riak users! > > I'm looking at the sample here: > http://docs.basho.com/riak/latest/dev/using/2i/ and wondering if there is > a way to use more complicated logic when using 2i input filters to limit > the input to a MapReduce function. > > For example, can I do stuff like "index1_bin in range[1,10] OR in range > [21:30]", or "index1_bin in range [1;50] AND index2_bin in range[5;10]" or > maybe even "key in range[aaa,zzz] AND index1_bin in range[1,10]" (where key > is the actual key from the objects key-value)]? And can I specify if the > start/end values should be included? If so, where can I read about this? > > Thanks, > Gints > > ___ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Re: 2i, search or something else for most efficient 'range' lookup
Hi Michael, thanks for the response. That's an interesting idea... which would work if the results were ordered. I'll have to test that out. I guess the downside would be if the riak server(s) holding the correct result were unavailable for any reason. In that, we could end up getting the wrong value. It's not the safest solution, but might be the most optimal (assuming the results were actually returned in ascending order). YN shared this with you. Re: 2i, search or something else for most efficient "range" lookup Via Nabble - Riak Users Index by endVal and select a range from Value to undefined with max_results=1. ___ riak-users mailing list [hidden email] http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com Sent from InoReader ___ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Re: MapReduce with 2i input filters
There is no way to do this directly. If you need joins (2, 3) or unions (1), the easiest thing that you can do is use Riak Search/Yokozuna to feed your MapReduce query instead of using a 2i input. In response to your specific examples: For #1 you could use an input where index1_bin in range [1,30] and then have the first map remove 11-21. For #2 and #3 you could pick one of the conditions that you know to be the more selective condition, use that as the MapReduce input and then use the first MR phase to perform the other search. But, as I mentioned in the first paragraph - Riak Search or Yokozuna seem like a far more effective fit. --- Jeremiah Peschka - Founder, Brent Ozar Unlimited MCITP: SQL Server 2008, MVP Cloudera Certified Developer for Apache Hadoop On Sat, Aug 24, 2013 at 8:49 AM, Gints Gailītis wrote: > I guess it's bit hard to read the 3 samples I asked for, I'll spell them > out like this: > 1) index1_bin in range[1,10] OR in range [21:30] > 2) index1_bin in range [1;50] AND index2_bin in range[5;10] > 3) key in range[aaa,zzz] AND index1_bin in range[1,10] (where key is the > actual key from the objects key-value) > > Thanks, > Gints > > > > On Sat, Aug 24, 2013 at 6:35 PM, Gints Gailītis > wrote: > >> Hi Riak users! >> >> I'm looking at the sample here: >> http://docs.basho.com/riak/latest/dev/using/2i/ and wondering if there >> is a way to use more complicated logic when using 2i input filters to limit >> the input to a MapReduce function. >> >> For example, can I do stuff like "index1_bin in range[1,10] OR in range >> [21:30]", or "index1_bin in range [1;50] AND index2_bin in range[5;10]" or >> maybe even "key in range[aaa,zzz] AND index1_bin in range[1,10]" (where key >> is the actual key from the objects key-value)]? And can I specify if the >> start/end values should be included? If so, where can I read about this? >> >> Thanks, >> Gints >> >> > > ___ > riak-users mailing list > riak-users@lists.basho.com > http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com > > ___ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com