pythonriakriak-search

Riak, How to delete an index that is already in use?


I am willing to delete an index that is already in use on a bucket, using python library:

client.delete_search_index(index_name)

But i get this error:

Can't delete index with associate buckets [{<<"my_bucket_type">>,<<"my_bucket">>}]'

I get it, I need to remove the binding between my bucket and my index first. So I try first to disable search_index property on the bucket:

bucket.set_property('search_index', '')
# or
bucket.set_property('search_index', None)
# or
bucket.set_property('search_index', 'null')
# or
bucket.set_properties('{search_index:null}')

Without a success, each time the HTTP error is casted as "Error setting bucket properties." by the library.

I still can assign another riak-search index, but I don't want to stress the riak cluster indexing stuff I won't use.

Is there a way to remove the search_index from bucket configuration using the python library ?


Solution

  • Change the bucket properties so that

    {"search_index": "_dont_index_"}

    I guess translated to Python it would be

    bucket.set_property('search_index', '_dont_index_')

    After the index has been disassociated from all the buckets it was associated with, you can delete it without a problem.

    I strongly recommend you to study the Riak documentation, it is really good and can save you lots of questions on Stack Overflow.