Riak Secondary Index Erlang example

Kelly McLaughlin kelly at basho.com
Thu Aug 11 22:59:57 EDT 2011


Senthilkumar,

I just tried some secondary index queries via Erlang and it's working fine for me. Getting the format just right can be a little tricky at first so here is an example. Say you have a bucket called mybucket and index called field1_bin. An example query for that index in Erlang would look like this:

	C:get_index(<<"mybucket">>, [{eq, <<"field1_bin">>, [<<"val1">>]}]).

Notice the bucket, index, and index value are binaries. Also the query as well as the index value are lists. Hopefully that helps get you going. Cheers.

Kelly


On Aug 11, 2011, at 4:09 PM, Senthilkumar Peelikkampatti wrote:

> I fired up riak console and got a local client (say C). C:get_index(Bucket, Query) where Query is {type, key, val} is crashing the riak. It works when I make http request through curl. So riak is setup correctly to index. It looks like I am doing something wrong. Is there an erlang api equivalent to rest?
> 
> -- 
> Regards,
> Senthilkumar Peelikkampatti,
> 
> 
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com





More information about the riak-users mailing list