# Clearing cache on stack with read only indices

**URL:** <https://discuss.elastic.co/t/clearing-cache-on-stack-with-read-only-indices/261507>\
**Category:** Elasticsearch\
**Created:** [January 19, 2021, 8:18am UTC](https://discuss.elastic.co/t/clearing-cache-on-stack-with-read-only-indices/261507 "2021-01-19T08:18:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![crs](https://avatars.discourse-cdn.com/v4/letter/c/977dab/32.png) [@crs](https://discuss.elastic.co/u/crs)\
**Post date:** [January 19, 2021, 8:18am UTC](https://discuss.elastic.co/t/clearing-cache-on-stack-with-read-only-indices/261507/1 "2021-01-19T08:18:53Z")

</div>

Hi,

I have system (ES 7.6.2) with many read only indices (`index.blocks.read_only=true`). All works fine but when I want to clear cache (`curl -X POST "localhost:9200/_cache/clear"`) then I'm getting a lot of errors "index [ranking\_202002] blocked by: [FORBIDDEN/5/index read-only (api)];". Any reason for that or this is bug in ES?

Kind regards -  
Krzysztof Ksiezyk

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [January 19, 2021, 8:57am UTC](https://discuss.elastic.co/t/clearing-cache-on-stack-with-read-only-indices/261507/2 "2021-01-19T08:57:30Z")

</div>

You probably want to use `index.blocks.write` rather than `index.blocks.read_only`. The read-only block doesn't allow metadata changes, including clearing the cache, but it sounds like you only want to block writes.

---

<div class="post-metadata">

**Author:** ![crs](https://avatars.discourse-cdn.com/v4/letter/c/977dab/32.png) [@crs](https://discuss.elastic.co/u/crs)\
**Post date:** [January 19, 2021, 9:15am UTC](https://discuss.elastic.co/t/clearing-cache-on-stack-with-read-only-indices/261507/3 "2021-01-19T09:15:43Z")

</div>

I know about index.blocks.write and differences with "read\_only" but it's more convenient for me to use read\_only as it protects also against incidental removing or messing with index aliases. Just didn't see any connection between index metadata and cluster cache so asked this question

---

<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 16, 2021, 9:15am UTC](https://discuss.elastic.co/t/clearing-cache-on-stack-with-read-only-indices/261507/4 "2021-02-16T09:15:48Z")

</div>

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