# Way to make a shard completely read-only?

**URL:** <https://discuss.elastic.co/t/way-to-make-a-shard-completely-read-only/62059>\
**Category:** Elasticsearch\
**Created:** [October 3, 2016, 11:50am UTC](https://discuss.elastic.co/t/way-to-make-a-shard-completely-read-only/62059 "2016-10-03T11:50:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jbbarth](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jbbarth/32/12266_2.png) [@jbbarth](https://discuss.elastic.co/u/jbbarth)\
**Post date:** [October 3, 2016, 11:50am UTC](https://discuss.elastic.co/t/way-to-make-a-shard-completely-read-only/62059/1 "2016-10-03T11:50:55Z")

</div>

Hi,

I'm running a ~30TB ES cluster on v1.7.5 and we try to make recoveries faster. We have several indices, but only one receives writes at a time. Other are "cold", they only receive reads. They've already been optimized to 1 segment.

We noticed that as expected, recoveries are near instant when the shard has a "sync\_id" key and it's identical to the primary shards they're replicated from. So we'd like shards on "cold" indices to be read-only so when they get a "sync\_id" and keep it.

In practice very old indices are not requested that much and they keep the same sync\_id forever. On more recent indices I see the "sync\_id" disappear and the "generation" ID is incremented (as seen with /\_stats/commit?level=shards). I guess it's because Lucene (or ES?) does some internal optimizations depending on queries load.

Is there a way to freeze shards with some of the index settings? I tried "index.blocks.metadata=true" but unfortunately it breaks some "cat" APIs (at least /\_cat/indices). I also tried "index.blocks.read\_only=true" but it's not enough.

Thanks,

Jean-Baptiste

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [October 3, 2016, 11:52am UTC](https://discuss.elastic.co/t/way-to-make-a-shard-completely-read-only/62059/2 "2016-10-03T11:52:55Z")

</div>

You need to upgrade to 2.X to get synced flush. Otherwise you cannot set a shard read only, only an index.

---

<div class="post-metadata">

**Author:** ![jbbarth](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jbbarth/32/12266_2.png) [@jbbarth](https://discuss.elastic.co/u/jbbarth)\
**Post date:** [October 3, 2016, 11:58am UTC](https://discuss.elastic.co/t/way-to-make-a-shard-completely-read-only/62059/3 "2016-10-03T11:58:05Z")

</div>

Our client code is not ready for 2.0 unfortunately. We already issue regular "/\_flush/synced", which works well on 1.7.5. And setting the index as read-only is not enough as stated above.

Do you mean that in 2.0 issuing a "/\_flush/synced" would improve the situation regarding indices being "really" read-only?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [October 3, 2016, 7:43pm UTC](https://discuss.elastic.co/t/way-to-make-a-shard-completely-read-only/62059/4 "2016-10-03T19:43:54Z")

</div>

Different API - [https://www.elastic.co/guide/en/elasticsearch/reference/2.4/indices-synced-flush.html](https://www.elastic.co/guide/en/elasticsearch/reference/2.4/indices-synced-flush.html)

---

<div class="post-metadata">

**Author:** ![jbbarth](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jbbarth/32/12266_2.png) [@jbbarth](https://discuss.elastic.co/u/jbbarth)\
**Post date:** [October 5, 2016, 8:37am UTC](https://discuss.elastic.co/t/way-to-make-a-shard-completely-read-only/62059/5 "2016-10-05T08:37:17Z")

</div>

This doc doesn't differ from what was already here in 1.7.x: [https://www.elastic.co/guide/en/elasticsearch/reference/1.7/indices-synced-flush.html](https://www.elastic.co/guide/en/elasticsearch/reference/1.7/indices-synced-flush.html) ; but sure, I imagine internals could have changed, bugs may have been fixed, so I'll upgrade as soon as possible.

Other ideas welcome!

---

<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:** [July 5, 2017, 10:14pm UTC](https://discuss.elastic.co/t/way-to-make-a-shard-completely-read-only/62059/6 "2017-07-05T22:14:50Z")

</div>


