Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to undo setting Elasticsearch Index to readonly?

So I just set one of my indices to readonly, and now want to delete it.

To set it to readonly:

PUT my_index/_settings { "index": { "index.blocks.read_only" : true } } 

When I tried to delete it I got this response:

ClusterBlockException[blocked by: [FORBIDDEN/5/index read-only (api)];] 

Then I tried to set the index to readonly false:

PUT my_index/_settings { "index": { "index.blocks.read_only" : false } } 

But that gives the same error message as above. So how to set readonly back to false?

like image 524
Ben Wilde Avatar asked Jan 20 '16 21:01

Ben Wilde


1 Answers

Answers are really old so I'll add a elastic-6+ answer too:

PUT /[_all|<index-name>]/_settings {   "index.blocks.read_only_allow_delete": null } 

https://www.elastic.co/guide/en/elasticsearch/reference/6.x/disk-allocator.html

FYI (for context): I ran into read-only indices due to running out of disk and got error messages from logstash:

...retrying failed action with response code: 403 ({"type"=>"cluster_block_exception", "reason"=>"blocked" 

elasticsearch:
ClusterBlockException[blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];]

like image 194
Kristofer Avatar answered Sep 23 '22 17:09

Kristofer