Riak,如何删除已在使用的索引?

时间:2016-03-11 14:59:23

标签: python riak riak-search

我愿意使用python库删除已在桶上使用的索引:

client.delete_search_index(index_name)

但是我收到了这个错误:

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

我明白了,我需要首先删除我的存储桶和索引之间的绑定。所以我首先尝试禁用存储桶上的search_index属性:

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}')

没有成功,每次HTTP错误被库“Error setting bucket properties.”转换为

我仍然可以分配另一个riak-search索引,但我不想强调riak集群索引我不会使用的东西。

有没有办法使用python库从存储桶配置中删除search_index

1 个答案:

答案 0 :(得分:4)

更改存储桶属性以便

{"search_index": "_dont_index_"}

我想将其翻译成Python就是

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

在索引与其关联的所有存储桶取消关联后,您可以毫无问题地将其删除。

我强烈建议你学习Riak documentation,这非常好,可以为你节省很多关于Stack Overflow的问题。