Querying multiple 2i via Intersections

Guido Medina guido.medina at temetra.com
Sat Jul 27 14:18:14 EDT 2013


I get you now, I was confused by the fact that he asked explicitly about 
2i, so when you mentioned indexes I thought you were referring to 2i, I 
would categorize Riak Search and Yokozuna as an alternative due to extra 
effort, schema definition and post-commits hooks, so for the straight 
question he asked the answer would be no, the alternatives, those you 
mentioned.

Guido.

On 27/07/13 17:12, Jeremiah Peschka wrote:
> No, I never said or hinted that you could join 2i indices using Riak 
> Search.
>
> You can, however, query against multiple indexed fields with Riak 
> Search. Here's what that would look like in CorrugatedIron:
>
> varreq=newRiakSearchRequest
> {
> Query=newRiakFluentSearch("riak_search_bucket","date")
> };
>
> req.Query.Search("2012-01-03")
> .And("category", "sandwiches");
>
> varresult=Client.Search(req);
>
>
> This becomes a Riak Search query on the riak_search_bucket with the 
> syntax date:2012-01-03 AND category:sandwiches
>
> The trick with Riak Search is that the objects you're saving have to 
> be readable by Riak Search. If you can't encode field names in a way 
> that is expected by Search, you'll need to specify a search schema so 
> that Riak Search knows which data types to index.
>
> See Using Search[1] and Search Schema[2] for implementation details
>
> [1]: http://docs.basho.com/riak/latest/dev/using/search/
> [2]: http://docs.basho.com/riak/latest/dev/advanced/search-schema/
>
> ---
> Jeremiah Peschka - Founder, Brent Ozar Unlimited
> MCITP: SQL Server 2008, MVP
> Cloudera Certified Developer for Apache Hadoop
>
>
> On Sat, Jul 27, 2013 at 11:44 AM, Guido Medina 
> <guido.medina at temetra.com <mailto:guido.medina at temetra.com>> wrote:
>
>     Are you saying that you can join two 2i indexes? Let's say you
>     have a 2i named "date" and another named "category" so you could
>     get a list of modified objects on a date and for a specific
>     category with Riak Search?
>
>     Guido.
>
>
>     On 27/07/13 16:32, Jeremiah Peschka wrote:
>>     Both Riak Search (currently) and Yokozuna (future) provide the
>>     ability to perform joins of multiple indices on the same bucket
>>     objects.
>>
>>     I find it best to think of 2i as an extension of what Riak KV
>>     already does well - fast key based lookups.
>>
>>     Search and Yokozuna provide complex query semantics.
>>
>>     ---
>>     Jeremiah Peschka - Founder, Brent Ozar Unlimited
>>     MCITP: SQL Server 2008, MVP
>>     Cloudera Certified Developer for Apache Hadoop
>>
>>
>>     On Sat, Jul 27, 2013 at 11:16 AM, Guido Medina
>>     <guido.medina at temetra.com <mailto:guido.medina at temetra.com>> wrote:
>>
>>         Rohman,
>>
>>         I think the reason for this is that the cluster will have to
>>         do the whole intersection in memory, 2i only provides queries
>>         for 1 single index and then return that result to either the
>>         client streaming or not, intersection indeed will require a
>>         MapReduce job to get a hold of both lists and intersect it,
>>         honestly, I wish that was possible, I think that's why I'm
>>         learning Erlang at the moment, we all wanted "join" like
>>         functionality with 2i to be honest but I don't think that is
>>         going to happen before version 1.5 if ever.
>>
>>         If you noticed, Riak 1.4 added 2i streaming which IMHO is
>>         like moving farer away from handling results in memory, if
>>         you get the point of what I mean. Join 2i queries in Riak
>>         will be an issue for a long time.
>>
>>         HTH,
>>
>>         Guido.
>>
>>
>>         On 27/07/13 14:20, Antonio Rohman Fernandez wrote:
>>
>>             Hi there,
>>
>>             I didn't fully check the new release notes yet, but I
>>             guess that Riak 1.4 doesn't have the ability to query
>>             multiple 2i at the same time... how difficult may be to
>>             implement a multiple 2i query via their intersecting
>>             items in their arrays? Maybe we could have this in future
>>             versions?
>>
>>             I normally do this with scripts before doing a MapReduce,
>>             if the data I want to look for is having 2 indexes
>>             conditions, I get the array of items of each 2i query,
>>             then get only the items found on both arrays and use it
>>             as a MapReduce input list.
>>
>>             However, done in my app's side is a bit costly as Riak
>>             needs to give me the full items arrays and then I need to
>>             process them to find repeated keys.
>>
>>             I really wish for Riak to be able to query multiple 2i
>>             soon as it will help a lot.
>>
>>             Merci,
>>             Rohman
>>
>>             Sent from my iPhone
>>             _______________________________________________
>>             riak-users mailing list
>>             riak-users at lists.basho.com
>>             <mailto:riak-users at lists.basho.com>
>>             http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>>
>>
>>
>>         _______________________________________________
>>         riak-users mailing list
>>         riak-users at lists.basho.com <mailto:riak-users at lists.basho.com>
>>         http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>>
>>
>>
>>
>>     _______________________________________________
>>     riak-users mailing list
>>     riak-users at lists.basho.com  <mailto:riak-users at lists.basho.com>
>>     http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
>
>     _______________________________________________
>     riak-users mailing list
>     riak-users at lists.basho.com <mailto:riak-users at lists.basho.com>
>     http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20130727/ae1e255e/attachment.html>


More information about the riak-users mailing list