fix ElasticSearch [FORBIDDEN/12/index read-only / allow delete (api)]

Published on Aug. 22, 2023, 12:10 p.m.

ElasticSearch

elasticsearch.exceptions.AuthorizationException: AuthorizationException(403, ‘cluster_block_exception’, ‘blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];’)

curl -X PUT “http://127.0.0.1:9200/_cluster/settings?pretty” -H ‘Content-Type: application/json’ -d’ { “transient”: { “cluster.routing.allocation.disk.watermark.low”: “50gb”, “cluster.routing.allocation.disk.watermark.high”: “20gb”, “cluster.routing.allocation.disk.watermark.flood_stage”: “10gb”, “cluster.info.update.interval”: “1m”}}’

Disable disk check by hitting below cluster update API:

curl -XPUT -H “Content-Type: application/json” http://localhost:9200/_all/_settings -d ‘{“index.blocks.read_only_allow_delete”: null}’

curl -XPUT -H “Content-Type: application/json” http://localhost:9200/_cluster/settings-d ‘{“transient”: { “cluster.routing.allocation.disk.threshold_enabled”: false }}’

links:
https://stackoverflow.com/questions/50609417/elasticsearch-error-cluster-block-exception-forbidden-12-index-read-only-all
https://techoverflow.net/2019/04/17/how-to-fix-elasticsearch-forbidden-12-index-read-only-allow-delete-api/

https://opster.com/analysis/flood-stage-disk-watermark-exceeded-on-all-indices-on-this-node-will-be-marked-read-only/