Riak Search Issue

Alex De la rosa alex.rosa.box at gmail.com
Mon Aug 18 12:14:54 EDT 2014


In case is of help, here are the steps I followed:

---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
STEP 1: CREATE SEARCH INDEX: mywantedindex
---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
PYTHON:
  client.create_search_index('mywantedindex')

---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
STEP 2: VERIFY INDEX
---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
CURL:
  http://RIAK:8098/search/index/mywantedindex
  => {"name":"mywantedindex","n_val":3,"schema":"_yz_default"}

---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
STEP 3: CREATE BUCKET TYPE: anothertry
---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
SHELL:
  riak-admin bucket-type create anothertry
'{"props":{"search_index":"mywantedindex"}}'
  => anothertry created
  riak-admin bucket-type activate anothertry
  => anothertry has been activated

---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
STEP 4: CREATE BUCKET TO STORE OBJECTS: pleasework
---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
PYTHON:
  bucket = client.bucket_type('anothertry').bucket('pleasework')
  bucket.enable_search()
  bucket.set_property('search_index', 'mywantedindex')
  key = bucket.new('cat-1', data={"name":"Felix","species":"Felis catus"},
content_type='application/json')
  key.store()
  print bucket.search('name=Felix')

---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
RESULT: ERROR!
---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
riak.RiakError: 'No index <<"pleasework">> found.'

Thanks,
Alex


On Mon, Aug 18, 2014 at 5:59 PM, Alex De la rosa <alex.rosa.box at gmail.com>
wrote:

> Hi Luke,
>
> Yes, I'm using the version 2.1.0rc1 installed via PIP as explained by Sean
> in another thread here.
>
> Thanks,
> Alex
>
>
> On Mon, Aug 18, 2014 at 5:57 PM, Luke Bakken <lbakken at basho.com> wrote:
>
>> Hi Alex,
>>
>> I'll work on reproducing this error, thank you for the details. I'm
>> assuming you're using the 2.1.0rc1 version of the Python client
>> available here:
>>
>> https://pypi.python.org/pypi?:action=display&name=riak#downloads
>>
>> --
>> Luke Bakken
>> CSE
>> lbakken at basho.com
>>
>>
>> On Mon, Aug 18, 2014 at 8:47 AM, Alex De la rosa
>> <alex.rosa.box at gmail.com> wrote:
>> > Hi Luke,
>> >
>> > Same error:
>> >
>> > bucket = client.bucket_type('animals').bucket('cats')
>> > bucket.enable_search()
>> > bucket.set_property('search_index', 'famous') # NEW: Setting the search
>> > index to the bucket
>> > key = bucket.new('feliz', data={"name":"Felix","species":"Felis catus"},
>> > content_type='application/json')
>> > key.store()
>> > print bucket.search('name=Felix')
>> >
>> > Output:
>> >
>> > Traceback (most recent call last):
>> >   File "x.py", line 11, in <module>
>> >     print bucket.search('name=Felix')
>> >   File "/usr/local/lib/python2.7/dist-packages/riak/bucket.py", line
>> 420, in
>> > search
>> >     return self._client.fulltext_search(self.name, query, **params)
>> >   File
>> "/usr/local/lib/python2.7/dist-packages/riak/client/transport.py",
>> > line 184, in wrapper
>> >     return self._with_retries(pool, thunk)
>> >   File
>> "/usr/local/lib/python2.7/dist-packages/riak/client/transport.py",
>> > line 126, in _with_retries
>> >     return fn(transport)
>> >   File
>> "/usr/local/lib/python2.7/dist-packages/riak/client/transport.py",
>> > line 182, in thunk
>> >     return fn(self, transport, *args, **kwargs)
>> >   File
>> "/usr/local/lib/python2.7/dist-packages/riak/client/operations.py",
>> > line 573, in fulltext_search
>> >     return transport.search(index, query, **params)
>> >   File
>> >
>> "/usr/local/lib/python2.7/dist-packages/riak/transports/pbc/transport.py",
>> > line 564, in search
>> >     MSG_CODE_SEARCH_QUERY_RESP)
>> >   File
>> >
>> "/usr/local/lib/python2.7/dist-packages/riak/transports/pbc/connection.py",
>> > line 50, in _request
>> >     return self._recv_msg(expect)
>> >   File
>> >
>> "/usr/local/lib/python2.7/dist-packages/riak/transports/pbc/connection.py",
>> > line 142, in _recv_msg
>> >     raise RiakError(err.errmsg)
>> > riak.RiakError: 'No index <<"cats">> found.'
>> >
>> > Thanks,
>> > Alex
>> >
>> >
>> > On Mon, Aug 18, 2014 at 5:00 PM, Luke Bakken <lbakken at basho.com> wrote:
>> >>
>> >> Alex -
>> >>
>> >> Let's take a step back and try out the "famous" index and "animals"
>> >> bucket type, which you have confirmed are set up correctly. This
>> >> (untested) code should create an object ("cat-1") in the "cats" bucket
>> >> (within the "animals" bucket type), which will then be indexed by the
>> >> "famous" index:
>> >>
>> >> bucket = client.bucket_type('animals').bucket('cats')
>> >> obj = RiakObject(client, bucket, 'cat-1')
>> >> obj.content_type = 'application/json'
>> >> obj.data = { 'name': 'Felix', 'species': 'Felis catus' }
>> >> obj.store()
>> >>
>> >> --
>> >> Luke Bakken
>> >> CSE
>> >> lbakken at basho.com
>> >>
>> >> On Mon, Aug 18, 2014 at 7:50 AM, Alex De la rosa
>> >> <alex.rosa.box at gmail.com> wrote:
>> >> > Hi Luke,
>> >> >
>> >> > I also tried with a normal bucket "cats" using the type "animals" as
>> the
>> >> > documentation seemed to suggest and gave me the same error but this
>> time
>> >> > saying that "cats" was not found as an index... so... still no clue
>> how
>> >> > to
>> >> > do it.
>> >> >
>> >> > This is an alternate code I did looking at the Python client API
>> >> > documentation, etc...
>> >> >
>> >> > client.create_search_index('men')
>> >> > bucket = client.bucket('accounts')
>> >> > bucket.enable_search()
>> >> > bucket.set_property('search_index', 'men')
>> >> > key = bucket.new('alex',
>> data={"username":"Alex","age":25,"sex":"male"},
>> >> > content_type='application/json')
>> >> > key.store()
>> >> > print bucket.search('sex=male')
>> >> >
>> >> > Again, it says "accounts" is not an index... in this code no bucket
>> >> > types
>> >> > are used, just a plain bucket "accounts"... what is wrong? what is
>> >> > missing
>> >> > for it to work??
>> >> >
>> >> > This is really frustrating.
>> >> >
>> >> > Thanks,
>> >> > Alex
>> >> >
>> >> >
>> >> > On Mon, Aug 18, 2014 at 4:44 PM, Luke Bakken <lbakken at basho.com>
>> wrote:
>> >> >>
>> >> >> Hi Alex -
>> >> >>
>> >> >> You correctly created the "famous" index, as well as correctly
>> >> >> associated it with the bucket *type* "animals". Note that a bucket
>> >> >> type is not the same thing as a bucket in previous versions of
>> Riak. A
>> >> >> bucket type is a way to give 1 or more buckets within that type the
>> >> >> same properties. You'll have to use different code in your Riak
>> client
>> >> >> to use bucket types:
>> >> >>
>> >> >> http://docs.basho.com/riak/2.0.0/dev/advanced/bucket-types/
>> >> >>
>> >> >> --
>> >> >> Luke Bakken
>> >> >> CSE
>> >> >> lbakken at basho.com
>> >
>> >
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20140818/c1b0f508/attachment.html>


More information about the riak-users mailing list