title: Uncaught Elasticsearch\Common\Exceptions\Forbidden403Exception [FORBIDDEN/12/index read-only / allow delete (api)];"}]
body: <p>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:</p>
  
  <pre><code>[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
  </code></pre>
  
  <p><a href="https://techoverflow.net/2019/04/17/how-to-fix-elasticsearch-forbidden-12-index-read-only-allow-delete-api/" rel="nofollow noreferrer">This post</a> has helped me resolve it momentarily with:</p>
  
  <pre><code>curl -XPUT -H "Content-Type: application/json" http://localhost:9200/_all/_settings -d '{"index.blocks.read_only_allow_delete": null}'
  </code></pre>
  
  <p>However, this error keeps appearing and I do not understand why. Does anyone know how to permanently resolve this error?</p>
  
  <p>I'm on macOS Catalina (10.15) with Elasticsearch version:</p>
  
  <pre><code>  "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"
  }
  </code></pre>