0

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"
}
robskrob
  • 2,720
  • 4
  • 31
  • 58
  • This can happen when your cluster fills up, see this related issue and let us know if that fixes your problem: https://stackoverflow.com/questions/50609417/elasticsearch-error-cluster-block-exception-forbidden-12-index-read-only-all – IanGabes Jan 09 '20 at 21:10
  • Hi @IanGabes thank you for your comment. That curl command, PUT _cluster/settings, which the SO post recommends does not work for me. I get the same error. I copied the curl command from the official docs it sites: https://www.elastic.co/guide/en/elasticsearch/reference/6.2/disk-allocator.html – robskrob Jan 09 '20 at 21:54
  • @IanGabes it appears that this answer (not the accepted one), https://stackoverflow.com/a/57675654/2524631, might have worked. I will let you know if it does not. – robskrob Jan 09 '20 at 21:55
  • i dont recommend following the advice in the linked answer. That will turn off the "high water mark" functionality, and allow you to completely foll up your os's disk. This can break other stuff on your os – IanGabes Jan 09 '20 at 23:51
  • The real solution to your problem is getting more diskspace, or reducing your total disk usage – IanGabes Jan 09 '20 at 23:52

0 Answers0