# Cannot update ES settings using ElasticSearch-PHP

**URL:** <https://discuss.elastic.co/t/cannot-update-es-settings-using-elasticsearch-php/162064>\
**Category:** Elasticsearch\
**Created:** [December 25, 2018, 11:46am UTC](https://discuss.elastic.co/t/cannot-update-es-settings-using-elasticsearch-php/162064 "2018-12-25T11:46:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hamideh.D](https://avatars.discourse-cdn.com/v4/letter/h/ba9def/32.png) [@Hamideh.D](https://discuss.elastic.co/u/Hamideh.D)\
**Post date:** [December 25, 2018, 11:46am UTC](https://discuss.elastic.co/t/cannot-update-es-settings-using-elasticsearch-php/162064/1 "2018-12-25T11:46:11Z")

</div>

There is already an index in ES. I am using ElasticSearch-PHP as client.  
According to [ES docs](https://www.elastic.co/guide/en/elasticsearch/client/php-api/5.0/_index_management_operations.html) 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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 22, 2019, 11:46am UTC](https://discuss.elastic.co/t/cannot-update-es-settings-using-elasticsearch-php/162064/2 "2019-01-22T11:46:15Z")

</div>

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