elasticsearch

How to undo setting Elasticsearch Index to readonly?


So I just set one of my indices to readonly, and now want to delete it.

To set it to readonly:

PUT my_index/_settings
{ "index": { "index.blocks.read_only" : true } }

When I tried to delete it I got this response:

ClusterBlockException[blocked by: [FORBIDDEN/5/index read-only (api)];]

Then I tried to set the index to readonly false:

PUT my_index/_settings
{ "index": { "index.blocks.read_only" : false } }

But that gives the same error message as above. So how to set readonly back to false?


Solution

  • The correct way to make es index read-only is

    PUT your_index/_settings
    {
      "index": {
        "blocks.read_only": true
      }
    }
    

    change true to false to undo it.

    You set non dynamic setting with

       {
          "index": {
            "blocks.read_only": false
          }
        }
    

    which I think was not your intention. Also I think you should have seen an error during first operation itself as non dynamic settings can be updated only on close indices.

    run

    POST your_index/_close
    

    and then try changing it.