解决 Elasticsearch 报错 cluster_block_exception cannot write indices
分析 Elasticsearch 集群因元数据写入阻断或动态配置锁定报 cannot write indices 根因,提供 cluster.blocks 清除方案。
问题现象
向 Elasticsearch 写入文档时返回 HTTP 403:
{
"error": {
"root_cause": [
{
"type": "cluster_block_exception",
"reason": "blocked by: [FORBIDDEN/8/index write (api)];"
}
]
},
"status": 403
}
触发根因
索引设置了 index.blocks.write: true,禁止写入操作。
解决步骤与操作命令
步骤一:在线重置写入锁定属性
curl -X PUT "http://localhost:9200/my-index/_settings" -H 'Content-Type: application/json' -d'
{
"index.blocks.write": null
}'
确认返回 {"acknowledged": true},写入立即恢复。


