Question about counters

Alex De la rosa alex.rosa.box at gmail.com
Tue Jul 1 05:10:31 EDT 2014


I found out on http://docs.basho.com/riak/2.0.0beta1/dev/using/search that
in Riak 2.0 additional steps are needed... i fixed my code as follows, but
still crashing:

-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
-----+-----+-----+-----+-----
import riak
client = riak.RiakClient(protocol='pbc',
nodes=[{'host':'127.0.0.1','http_port':8098,'pb_port':8087}])
client.create_search_index('men') # NEW: Creating a search index
bucket = client.bucket('accounts')
bucket.enable_search()
bucket.set_property('search_index', 'men') # NEW: Setting the search index
to the bucket
key = bucket.new('alex', data={"username":"Alex","age":25,"sex":"male"},
content_type='application/json')
key.store()
print bucket.search('sex=male')
-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----

this time seems the Python client is not fully updated again and missing
functionality (like "counters"):

-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----
Traceback (most recent call last):
  File "test.py", line 3, in <module>
    client.create_search_index('men')
AttributeError: 'RiakClient' object has no attribute 'create_search_index'
-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----

Is a problem of the Python client? Or there is something wrong on my code?
When will it be a Python client update solving all these issues? is a bit
frustrating wanting to try the features and see you can not do it because
the client is not fully operational.

Cheers,
Alex

On Tue, Jul 1, 2014 at 10:38 AM, Alex De la rosa <alex.rosa.box at gmail.com>
wrote:

> Hi there,
>
> I found out why Riak was not starting when I enabled it... JAVA was not
> installed!!... However, after installing Java and successfully started Riak
> with search enabled, when trying to use "search" it crashes very badly,
> this is the Java Version I have under Ubuntu Server 14.04 LTS:
>
> java version "1.7.0_60"
> Java(TM) SE Runtime Environment (build 1.7.0_60-b19)
> Java HotSpot(TM) 64-Bit Server VM (build 24.60-b09, mixed mode)
>
> This is my testing code using Python library:
>
> -----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----
>
> import riak
> client = riak.RiakClient(protocol='pbc',
> nodes=[{'host':'127.0.0.1','http_port':8098,'pb_port':8087}])
> bucket = client.bucket('accounts')
> bucket.enable_search()
> key = bucket.new('alex', data={"username":"Alex","age":25,"sex":"male"},
> content_type='application/json')
> key.store()
> print bucket.search('sex=male')
>
> # Code following example in:
> http://basho.github.io/riak-python-client/query.html#fulltext-search
>
>
> -----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----
> This is the error that Riak Search is giving to me:
>
> -----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----
>
> Traceback (most recent call last):
>   File "test.py", line 7, in <module>
>     bucket.search('sex=male')
>   File
> "/usr/local/lib/python2.7/dist-packages/riak-2.0.3-py2.7.egg/riak/bucket.py",
> line 446, in search
>   File
> "/usr/local/lib/python2.7/dist-packages/riak-2.0.3-py2.7.egg/riak/client/transport.py",
> line 127, in wrapper
>   File
> "/usr/local/lib/python2.7/dist-packages/riak-2.0.3-py2.7.egg/riak/client/transport.py",
> line 69, in _with_retries
>   File
> "/usr/local/lib/python2.7/dist-packages/riak-2.0.3-py2.7.egg/riak/client/transport.py",
> line 125, in thunk
>   File
> "/usr/local/lib/python2.7/dist-packages/riak-2.0.3-py2.7.egg/riak/client/operations.py",
> line 428, in fulltext_search
>   File
> "/usr/local/lib/python2.7/dist-packages/riak-2.0.3-py2.7.egg/riak/transports/pbc/transport.py",
> line 453, in search
>   File
> "/usr/local/lib/python2.7/dist-packages/riak-2.0.3-py2.7.egg/riak/transports/pbc/connection.py",
> line 43, in _request
>   File
> "/usr/local/lib/python2.7/dist-packages/riak-2.0.3-py2.7.egg/riak/transports/pbc/connection.py",
> line 55, in _recv_msg
> riak.RiakError: 'No index <<"accounts">> found.'
>
> -----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----
>
> Cheers,
> Alex
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20140701/7739b96a/attachment.html>


More information about the riak-users mailing list