'Searchkick: Elasticsearch not indexing "FORBIDDEN/12/index read-only"?

I've setup a new development environment on my iMac and moved my rails app from a macbook air. It was working fine and indexing the data as well. Using the same version of gems. When indexing it gives following error.

Searchkick::ImportError: {"type"=>"cluster_block_exception", "reason"=>"blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];"} on item with id '74'

Is there any way I can solve this issue by modifying my elasticsearch.yml?



Solution 1:[1]

This solution from salihsagdilekon on https://github.com/ankane/searchkick/issues/1040 resolved this same issue for me:

curl -XPUT -H "Content-Type: application/json" > http://localhost:9200/_all/_settings -d '{"index.blocks.read_only_allow_delete": null}'

Solution 2:[2]

I had the same issue today, and the following worked for me:

Model.search_index.clean_indices

Solution 3:[3]

You can execute the following in rails console:

MyModel.reindex

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ktravers
Solution 2
Solution 3 Dharman