I have a wordpress blog making HTTP calls to elasticsearch whenever it saves a post or a page. Every now and then when I save a page, I keep running into the following error from Elasticsearch:
[09-Jan-2020 20:32:00 UTC] Error trying to save record with index: 'page' id: '12'
[09-Jan-2020 20:32:00 UTC] PHP Fatal error: Uncaught Elasticsearch\Common\Exceptions\Forbidden403Exception: {"error":{"root_cause":[{"type":"cluster_block_exception","reason":"blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];"}],"type":"cluster_block_exception","reason":"blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];"},"status":403} in /Users/robskrob/code/projects/blog/personal/wordpress/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php:626
This post has helped me resolve it momentarily with:
curl -XPUT -H "Content-Type: application/json" http://localhost:9200/_all/_settings -d '{"index.blocks.read_only_allow_delete": null}'
However, this error keeps appearing and I do not understand why. Does anyone know how to permanently resolve this error?
I'm on macOS Catalina (10.15) with Elasticsearch version:
"name" : "Dt1WIXe",
"cluster_name" : "elasticsearch_robskrob",
"cluster_uuid" : "xxxxxxxxxxx",
"version" : {
"number" : "6.8.5",
"build_flavor" : "oss",
"build_type" : "tar",
"build_hash" : "xxxxxx",
"build_date" : "2019-11-13T20:04:24.100411Z",
"build_snapshot" : false,
"lucene_version" : "7.7.2",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}