searchkick: FORBIDDEN/12/index read-only / allow delete (api)
I’ve set up 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.
{"count":969,"exception":["Searchkick::ImportError","{\"type\"=\u003e\"cluster_block_exception\", \"reason\"=\u003e\"blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];\"} on item with id '75'"]}
Searchkick::ImportError: {"type"=>"cluster_block_exception", "reason"=>"blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];"} on item with id '75'
from /Users/Raj/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/searchkick-2.4.0/lib/searchkick/indexer.rb:23:in `perform'
from /Users/Raj/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/searchkick-2.4.0/lib/searchkick/logging.rb:126:in `perform'
from /Users/Raj/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/searchkick-2.4.0/lib/searchkick/indexer.rb:11:in `queue'
from /Users/Raj/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/searchkick-2.4.0/lib/searchkick/index.rb:535:in `bulk_index_helper'
from /Users/Raj/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/searchkick-2.4.0/lib/searchkick/index.rb:94:in `bulk_index'
from /Users/Raj/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/searchkick-2.4.0/lib/searchkick/logging.rb:73:in `block in bulk_index'
from /Users/Raj/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/notifications.rb:164:in `block in instrument'
from /Users/Raj/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
from /Users/Raj/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/notifications.rb:164:in `instrument'
from /Users/Raj/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/searchkick-2.4.0/lib/searchkick/logging.rb:72:in `bulk_index'
from /Users/Raj/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/searchkick-2.4.0/lib/searchkick/index.rb:445:in `block in import_or_update'
from /Users/Raj/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/searchkick-2.4.0/lib/searchkick/index.rb:524:in `with_retries'
from /Users/Raj/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/searchkick-2.4.0/lib/searchkick/index.rb:444:in `import_or_update'
from /Users/Raj/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/searchkick-2.4.0/lib/searchkick/index.rb:302:in `block in import_scope'
from /Users/Raj/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/relation/batches.rb:124:in `find_in_batches'
from /Users/Raj/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/searchkick-2.4.0/lib/searchkick/index.rb:301:in `import_scope'
from /Users/Raj/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/searchkick-2.4.0/lib/searchkick/index.rb:240:in `reindex_scope'
from /Users/Raj/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/searchkick-2.4.0/lib/searchkick/model.rb:72:in `searchkick_reindex'
from (irb):23
from /Users/Raj/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/railties-4.2.8/lib/rails/commands/console.rb:110:in `start'
from /Users/Raj/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/railties-4.2.8/lib/rails/commands/console.rb:9:in `start'
from /Users/Raj/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/railties-4.2.8/lib/rails/commands/commands_tasks.rb:68:in `console'
from /Users/Raj/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/railties-4.2.8/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /Users/Raj/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/railties-4.2.8/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Is there any way I can solve this issue by modifying my elasticsearch.yml?
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 16 (2 by maintainers)
this is solution.
source: https://benjaminknofe.com/blog/2017/12/23/forbidden-12-index-read-only-allow-delete-api-read-only-elasticsearch-indices/
Thanks @salihsagdilek 👍 Excerpt from the link:
@cireficc Agree According to Disk-based Shard Allocation The default for cluster.routing.allocation.disk.watermark.flood_stage is 95%. Meaning that once any index that has one or more shards allocated on a node that resides in a disk with storage exceeding 95%, this index will be forced to go into read-only mode. If this is the case, then:
@ankane & @others Changing ES index settings didn’t fix the issue for me. The only thing that worked was to free up disk space… I think Elasticsearch does some calculation on the estimated index size and completely prevents indexing if it is more than the available disk space. I was able to index a few individual records, but as soon as I did
MyModel.reindex
, I got that error. Once I freed up a few GB of disk space, reindexing went smoothly.@salihsagdilek, thanks a lot, you saved my day.
At least on windows you need to replace ’ with " for field names: curl -XPUT -H “Content-Type: application/json” http://localhost:9200/_all/_settings -d “{"index.blocks.read_only_allow_delete": false}”
Elasticsearch tells you: JsonParseException: Unexpected character (‘’’ (code 39)): was expecting double-quote to start field name