hd.
hd.

Reputation: 18306

Cannot update ES settings using ElasticSearch-PHP

There is already an index in ES. I am using ElasticSearch-PHP as client. According to ES docs these code should change ES settings:

$params = [
   'index' => 'my_index',
   'body' => [
      'settings' => [
         'number_of_replicas' => 0,
         'refresh_interval' => -1
       ]
    ]
];

$response = $client->indices()->putSettings($params);

But after running code this error is shown:

**Fatal error** : Uncaught exception 'Elasticsearch\Common\Exceptions\Forbidden403Exception' with message '{"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}

How can I solve it? Thank you in advance.

Upvotes: 0

Views: 484

Answers (1)

Prasad Honavar
Prasad Honavar

Reputation: 117

Your elasticsearch server host machine is probably low on storage. Run the following in Kibana Dev tools. Should at least temporarily fix the issue.

PUT .kibana/_settings
{
  "index": {
    "blocks": {
      "read_only_allow_delete": "false"
    }
  }
}

Upvotes: 0

Related Questions