Riak Data Type + Search

Christopher Meiklejohn cmeiklejohn at basho.com
Mon Dec 1 12:44:34 EST 2014


> On Dec 1, 2014, at 12:28 PM, Taufan Adhitya <toopay at taufanaditya.com> wrote:
> 
> Hey Sean, thanks for the response.
> 
> I was looking the documentation section you've pointed, but I'm stuck on Counters/Sets/Maps in the Erlang client are opaque data structures that collect operations as you mutate them. We will associate the data structure with a bucket type, bucket, and key later on. part. How do associate/save some datatype object on some bucket/key then? 

Hi Taufan,

The link that Sean provided has information on how to create the bucket type.  Taken from the included link:

	riak-admin bucket-type create maps '{"props":{"datatype":"map"}}'

	riak-admin bucket-type create sets '{"props":{"datatype":"set"}}'

	riak-admin bucket-type create counters '{"props":{"datatype":"counter"}}'

I’ve also got a small riak_test example which uses the Erlang client to create the bucket type and operate over a key.  This might provide a good starting place to work from.

For example:

Creating a search index:
https://github.com/basho/riak_test/blob/master/tests/yz_crdt.erl#L33

Updating/creating a map with a register in it:
https://github.com/basho/riak_test/blob/master/tests/yz_crdt.erl#L50

Executing this with the client:
https://github.com/basho/riak_test/blob/master/tests/yz_crdt.erl#L56

Performing a search query with the client:
https://github.com/basho/riak_test/blob/master/tests/yz_crdt.erl#L66

- Chris

Christopher Meiklejohn
Senior Software Engineer
Basho Technologies, Inc.
cmeiklejohn at basho.com




More information about the riak-users mailing list