elasticsearch 6 index change to read only after few second

Convenience for copy/pasting into Kibana console

# disable threshold alert
PUT /_cluster/settings
{
  "persistent" : {
        "cluster.routing.allocation.disk.threshold_enabled" : false
    }
}

# unlock indices from read-only state
PUT /_all/_settings
{
  "index.blocks.read_only_allow_delete": null
}

I had this problem I think in elastic 6 add new setting to close index when empty hard less than 5% you can disable this by below line in elasticsearch.yml

 cluster.routing.allocation.disk.threshold_enabled: false

Then restart elasticsearch. I hope this work for you