Using Secondary Indices as input to a map reduce function in Riak

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Using Secondary Indices as input to a map reduce function in Riak

Barry Ryan

Hello,

I’m trying to use the output of a secondary index as the input to my mapreduce function which is written in javascript using the HTTP API to interact with Riak.  I found on the Riak web-site that it is possible:  'If you've enabled Secondary Indexes, the list of inputs can also reference a Secondary Index query'.  However, I couldn’t find anywhere that explained how you would do that or what it would look like. 

If  "input" : ["bucket", "key"] is the map reduce equivalent of ‘curl riakhost:port/riak/bucketname/key‘ then what is the input equivalent of ‘curl riakhost:port/buckets/bucketname/index/indexname_bin/indexvalue'?  Given that adding a third parameter to input is for keydata.

Additionally is it possible to include the value of your index in the output of the final reduce phase?

 

Kind regards,

Barry

 

BJSS Limited, 1st Floor, Coronet House, Queen Street, Leeds, LS1 2TW
T: 0113 297 9797 | F: 0113 297 9798 | W: http://www.bjss.com

 

The information included in this email and any files transmitted with it may contain information that is confidential and it must not be used by, or its contents or attachments copied or disclosed, to persons other than the intended addressee. If you have received this email in error, please notify BJSS. In the absence of written agreement to the contrary BJSS' relevant standard terms of contract for any work to be undertaken will apply. Please carry out virus or such other checks as you consider appropriate in respect of this email. BJSS do not accept responsibility for any adverse effect upon your system or data in relation to this email or any files transmitted with it. BJSS Limited, a company registered in England and Wales (Company Number 2777575), VAT Registration Number 613295452, Registered Office Address, First Floor, Coronet House, Queen Street, Leeds, LS1 2TW
_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Using Secondary Indices as input to a map reduce function in Riak

bryan-basho
Administrator
On Thu, Dec 6, 2012 at 12:22 PM, Barry Ryan <[hidden email]> wrote:
> I’m trying to use the output of a secondary index as the input to my
> mapreduce function which is written in javascript using the HTTP API to
> interact with Riak.  I found on the Riak web-site that it is possible:  'If
> you've enabled Secondary Indexes, the list of inputs can also reference a
> Secondary Index query'.  However, I couldn’t find anywhere that explained
> how you would do that or what it would look like.

Hi, Barry. That wording is a little confusing … instead of a list, the
"inputs" field should be a JSON object like:

    {"bucket":"mybucket",
     "index":"myindex_bin",
     "key":"my exact match"}

or

    {"bucket":"mybucket",
     "index":"myindex_int",
     "start":0
     "end":100}

More complete examples are near the bottom of
http://docs.basho.com/riak/latest/tutorials/Secondary-Indexes---Examples/

-Bryan

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