Counters inside Maps

Alex De la rosa alex.rosa.box at gmail.com
Tue Aug 19 17:59:22 EDT 2014


Imagine I have a Riak object "footballer" with some static fields: name,
team, number. I store them like this now:

1: CREATE INDEX FOR RIAK SEARCH
curl -XPUT "http://148.251.140.229:8098/search/index/ix_footballers"

2: CREATE BUCKET TYPE
riak-admin bucket-type create tp_footballers
'{"props":{"allow_mult":false,"search_index":"ix_footballers"}}'
riak-admin bucket-type activate tp_footballers

3: INSERT A PLAYER
bucket = client.bucket_type('tp_footballers').bucket('footballers')
key = bucket.new('lionelmessi', data={'name_s':'Messi',
'team_s':'Barcelona', 'number_i':10}, content_type='application/json')
key.store()

4: SEARCH FOR BARCELONA PLAYERS
r = client.fulltext_search('ix_footballers', 'team_s:Barcelona')

So far so good :) BUT... what if I want to have a field "goals_i" that is a
counter that will be incremented each match day with the number of goals he
scored? What is the syntax/steps to do to set up "footballers" as a MAP and
then put a COUNTER inside? I know is possible as I read it in some data
dump some Basho employee passed me some time ago, but I can't manage to see
how to do it now.

Thanks!
Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20140819/234c855b/attachment.html>


More information about the riak-users mailing list