# ElasticSearch bulk insert not OK using curl, message

**URL:** <https://discuss.elastic.co/t/elasticsearch-bulk-insert-not-ok-using-curl-message/112863>\
**Category:** Elasticsearch\
**Created:** [December 21, 2017, 5:01pm UTC](https://discuss.elastic.co/t/elasticsearch-bulk-insert-not-ok-using-curl-message/112863 "2017-12-21T17:01:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amouzigh\_Driss](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/amouzigh_driss/32/25868_2.png) [@Amouzigh\_Driss](https://discuss.elastic.co/u/Amouzigh_Driss)\
**Post date:** [December 21, 2017, 5:01pm UTC](https://discuss.elastic.co/t/elasticsearch-bulk-insert-not-ok-using-curl-message/112863/1 "2017-12-21T17:01:44Z")

</div>

Hello,  
I'm trying to use curl and call ElasticSearch bulk API.  
The call is like this:  
curl -XPOST "[http://localhost:9200/myindex/mytype/\_bulk](http://localhost:9200/myindex/mytype/_bulk)" --data-binary @req -H "Con  
tent-Type: application/x-ndjson" --user elastic:elastic\_pwd

req is a file, whose content is like this  
{ "index" : {} }  
{"ServerName":"WIN-562V873OTU7","DateAction":"2017-12-21T13:38:09","ID":"Simple ID","Timestamp":"2017-12-21T13:38:06","Value":"47"}

last file in req is ending with \n.

I have an error message:  
{"took":15,"errors":true,"items":[{"index":{"\_index":"myindex","\_type":"mytype","\_id":"7kKteWABgkkg9WN7eY86","status":403,"error":{"type":"cluster\_block\_exception","rea  
son":"blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];"}}}]}

I found a topic on that issue, the solution was to send a PUT  
[http://localhost:9200/myindex/\_settings/](http://localhost:9200/myindex/_settings/)  
{  
"index": {  
"blocks": {  
"read\_only\_allow\_delete": "false"  
}  
}  
}  
after this made, the call to curl is OK.  
But when sending another curl call, I have again the error message. (which is resolved using the PUT request to the URL \_\_\_/\_settings).

I don't want to send this request each time. It's why I tried to have in elasticsearch.yml the setting:  
index.blocks.read\_only\_allow\_delete: false

When restarted elasticsearch, I have a clear message indicating that this setting is not accepted:  
Found index level settings on node level configuration.

Since elasticsearch 5.x index level settings can NOT be set on the nodes  
configuration like the elasticsearch.yaml, in system properties or command line  
[arguments.In](http://arguments.In) order to upgrade all indices the settings must be updated via the  
/${index}/\_settings API. Unless all settings are dynamic all indices must be closed  
in order to apply the upgradeIndices created in the future should use index templates  
to set default values.

Please ensure all required values are updated on all indices by executing:

curl -XPUT '[http://localhost:9200/\_all/\_settings?preserve\_existing=true](http://localhost:9200/_all/_settings?preserve_existing=true)' -d '{  
"index.blocks.read\_only\_allow\_delete" : "false"  
}'

What should i do in this case?

Regards  
Driss

---

<div class="post-metadata">

**Author:** ![luiz.santos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/luiz.santos/32/24664_2.png) [@luiz.santos](https://discuss.elastic.co/u/luiz.santos)\
**Post date:** [December 29, 2017, 12:06pm UTC](https://discuss.elastic.co/t/elasticsearch-bulk-insert-not-ok-using-curl-message/112863/2 "2017-12-29T12:06:07Z")

</div>

Hi @Amouzigh_Driss,

This is not a expected behaviour to set `read_only_allow_delete: false` after every request, your index must be read-only or not.

Is there any other process that might be setting this index to read-only?

Cheers,  
LG

---

<div class="post-metadata">

**Author:** ![thiago](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thiago/32/32096_2.png) [@thiago](https://discuss.elastic.co/u/thiago)\
**Post date:** [December 29, 2017, 12:37pm UTC](https://discuss.elastic.co/t/elasticsearch-bulk-insert-not-ok-using-curl-message/112863/3 "2017-12-29T12:37:57Z")

</div>

Elasticsearch will only automatically change `read_only_allow_delete` to `true` starting with version **6.0** , when it hits a used disk space high watermark (by default is `95%` set by `cluster.routing.allocation.disk.watermark.flood_stage`).

Are you sure this is not version 6.x? If it's really 5.x, then it's like Luiz said, the setting `read_only_allow_delete` defaults to `false` and Elasticsearch will never change by it's own.

---

<div class="post-metadata">

**Author:** ![Amouzigh\_Driss](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/amouzigh_driss/32/25868_2.png) [@Amouzigh\_Driss](https://discuss.elastic.co/u/Amouzigh_Driss)\
**Post date:** [January 4, 2018, 11:18am UTC](https://discuss.elastic.co/t/elasticsearch-bulk-insert-not-ok-using-curl-message/112863/4 "2018-01-04T11:18:36Z")

</div>

Hello Mr @thiago and @luiz.santos

Thank you for your answers.  
You're right, i'm using elasticsearch-6.1.0 and have the message concerning the flood. ([o.e.c.r.a.DiskThresholdMonitor] [cTlqV5c] flood stage disk watermark [95%] exceeded on [cTlqV5c4QIyuT\_6-AJNJZQ])

I tried to use elasticsearch-2.1.0 and the problem was partially resolved.  
Partially, because I can change the **read\_only\_allow\_delete** to **false** and update elasticsearch using cURL from command line Prompt without any problem.

When trying to have modifications in 'real life' using a C# .Net program (which call periodically cURL to have these modifications) , things are different. The first call using the program is OK, but the others fail. (same behaviour when restarting the program).

I checked that even when I have failure using my C# program, the flag is always false, and can call cURL from command line prompt.

Regards  
Driss

---

<div class="post-metadata">

**Author:** ![thiago](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thiago/32/32096_2.png) [@thiago](https://discuss.elastic.co/u/thiago)\
**Post date:** [January 4, 2018, 11:55am UTC](https://discuss.elastic.co/t/elasticsearch-bulk-insert-not-ok-using-curl-message/112863/5 "2018-01-04T11:55:18Z")

</div>

What I can tell is that the setting `read_only_allow_delete` does not exists in 2.1 so setting it to either `true` or `false` does nothing.

Moreover, if you were getting the flood stage error before, in 6.1, it means your disk is 95% of usage and you should not be running an Elasticsearch node in such situation.

---

<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:** [February 1, 2018, 11:55am UTC](https://discuss.elastic.co/t/elasticsearch-bulk-insert-not-ok-using-curl-message/112863/6 "2018-02-01T11:55:31Z")

</div>

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