Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to index existing not-indexed data in riak search?

I am using Riak Search. At some point, I removed the index from the bucket. After having added some new objects into the bucket, I put the index back on.

When I search by the index, I can't find the objects which were not indexed.

How can I index them now? I think that the solution would be also suitable for other not-indexed legacy buckets as well.

like image 411
Hao Avatar asked Jun 11 '15 17:06

Hao


1 Answers

My solution for that and some similar problems with searchindices on Bucket-Types i use the following procedures (only in development) have no exp. in production with riak now so someone else has to answer that:

  1. delete the searchindex

    riakc_pb_socket:delete_search_index(Pid, <<"XXX">>, []).

  2. Reindex with creation of a new index (in this case with default values applied)

    riakc_pb_socket:create_search_index(Pid, <<"XXX">>, <<"_yz_default">>, []).

after that your index should be updated and you don`t have to change your code anyway....

happy coding with erlang and riak

Canislupax

like image 139
canislupax Avatar answered Oct 19 '22 11:10

canislupax