Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TransportError(403, u'cluster_block_exception', u'blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];')

When I try to store anything in elasticsearch, An error says that:

TransportError(403, u'cluster_block_exception', u'blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];')

I already inserted about 200 millions documents in my index. But I don't have an idea why this error is happening. I've tried:

curl -u elastic:changeme -XPUT 'localhost:9200/_cluster/settings' -H 'Content-Type: application/json' -d '{"persistent":{"cluster.blocks.read_only":false}}'

As mentioned here: ElasticSearch entered "read only" mode, node cannot be altered

And the results is:

{"acknowledged":true,"persistent":{"cluster":{"blocks":{"read_only":"false"}}},"transient":{}}

But nothing changed. what should I do?

like image 443
ehsan shirzadi Avatar asked Dec 30 '17 09:12

ehsan shirzadi


3 Answers

Try GET yourindex/_settings, this will show yourindex settings. If read_only_allow_delete is true, then try:

PUT /<yourindex>/_settings
{
  "index.blocks.read_only_allow_delete": null
}

I got my issue fixed.

plz refer to es config guide for more detail.

The curl command for this is

curl -X PUT "localhost:9200/twitter/_settings?pretty" -H 'Content-Type: application/json' -d '
{
  "index.blocks.read_only_allow_delete": null
}'
like image 171
truman liu Avatar answered Oct 15 '22 05:10

truman liu


Last month I facing the same problem, you can try this code on your Kibana Dev Tools

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

I hope it helps

like image 28
Imran273 Avatar answered Oct 15 '22 05:10

Imran273


I had faced the same issue when my disk space was full,

please see the steps that I did

1- Increase the disk space

2- Update the index read-only mode, see the following curl request

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

like image 6
Jamsheer Avatar answered Oct 15 '22 05:10

Jamsheer