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.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.