Ruby on Rails - searchkick gem : cluster_block_exception - FORBIDDEN/12/index read-only / allow delete (api) - status":403 Ruby on Rails - searchkick gem : cluster_block_exception - FORBIDDEN/12/index read-only / allow delete (api) - status":403 elasticsearch elasticsearch

Ruby on Rails - searchkick gem : cluster_block_exception - FORBIDDEN/12/index read-only / allow delete (api) - status":403


The following worked for me when I got this running rspec tests and the first dB insert setting up the test db env failed with this elastic search error. Fix extracted from here, the key observation:

By default, Elasticsearch installed with homebrew on Mac OS goes into read-only mode when you have less than 5% of free disk space.

curl -XPUT -H "Content-Type: application/json" http://localhost:9200/_cluster/settings -d '{ "transient": { "cluster.routing.allocation.disk.threshold_enabled": false } }'curl -XPUT -H "Content-Type: application/json" http://localhost:9200/_all/_settings -d '{"index.blocks.read_only_allow_delete": null}'


I fixed it by running Activity.search_index.delete in console and then reran Activity.reindex