0
votes

While indexing an item, it returns this error: index [] blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];

I found a solution : curl -XPUT -H "Content-Type: application/json" http://localhost:9200/_all/_settings -d '{"index.blocks.read_only_allow_delete": null}' source of solution : https://benjaminknofe.com/blog/2017/12/23/forbidden-12-index-read-only-allow-delete-api-read-only-elasticsearch-indices/

How to apply this settings with my ElasticClient object in NEST 7.x?

Thanks,

1

1 Answers

1
votes

With NEST 7.x

var client = new ElasticClient();

var response = client.Indices.UpdateSettings(Indices.All, u => u
    .IndexSettings(i => i
        .Setting("index.blocks.read_only_allow_delete", false)
    )
);

Most settings have a method for them, but this one doesn't currently (will add it). Where a method doesn't exist, .Setting() can be used with the setting name and value. Passing false results in the same behaviour as passing null.