Erlang client map reduce?

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

Erlang client map reduce?

Brandon Martin
So I am trying to figure out how to do a map reduce on a bucket type with the erlang client in erl. I didn’t see in the documentation how to do a map reduce with a bucket type. I have the bucket type and the bucket. I want to map reduce to basically filter out any documents whose createTime(which is just int/number) is less then 24 hours and return those. I have only been using riak for a few weeks and erlang for about a day. Any pointers or help would be appreciated.

Thanks

--
Brandon Martin



_______________________________________________
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
|

Re: Erlang client map reduce?

Luke Bakken
Hi Brandon -

The riak_object module exports a type() function that will return the
bucket type of an object in Riak
(https://github.com/basho/riak_kv/blob/develop/src/riak_object.erl#L589-L592).

MapReduce docs:
http://docs.basho.com/riak/kv/2.1.4/developing/app-guide/advanced-mapreduce/

In addition, here is a repository containing some exampe map/reduce
code: https://github.com/basho/riak_function_contrib/wiki

Having said all that, your use case may be better suited to Riak
Search. MapReduce is best run on an intermittent basis due to the load
it places on a cluster. Is your query something that will frequently
be run or could the output of the query be saved in Riak on a daily
basis, for instance?

--
Luke Bakken
Engineer
[hidden email]

On Thu, Sep 29, 2016 at 5:57 PM, Brandon Martin <[hidden email]> wrote:

> So I am trying to figure out how to do a map reduce on a bucket type with
> the erlang client in erl. I didn’t see in the documentation how to do a map
> reduce with a bucket type. I have the bucket type and the bucket. I want to
> map reduce to basically filter out any documents whose createTime(which is
> just int/number) is less then 24 hours and return those. I have only been
> using riak for a few weeks and erlang for about a day. Any pointers or help
> would be appreciated.
>
> Thanks
>
> --
> Brandon Martin

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