当我尝试在Elasticsearch中存储任何内容时,出现错误消息:
TransportError(403, u'cluster_block_exception', u'blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];')
我已经在索引中插入了大约2亿个文档。但我不知道为什么会发生此错误。我试过了:
curl -u elastic:changeme -XPUT 'localhost:9200/_cluster/settings' -H 'Content-Type: application/json' -d '{"persistent":{"cluster.blocks.read_only":false}}'
结果是:
{"acknowledged":true,"persistent":{"cluster":{"blocks":{"read_only":"false"}}},"transient":{}}
但是什么都没有改变。我该怎么办?
试试看GET yourindex/_settings,这将显示您的索引设置。如果read_only_allow_delete是true,请尝试:
GET yourindex/_settings
read_only_allow_delete
true
PUT /<yourindex>/_settings { "index.blocks.read_only_allow_delete": null }
我已经解决了问题。
请参阅《es配置指南》以获取更多详细信息。
curl命令是
curl -X PUT "localhost:9200/twitter/_settings?pretty" -H 'Content-Type: application/json' -d ' { "index.blocks.read_only_allow_delete": null }'