# Storing new elasticsearch documents while restoring an index

**URL:** <https://discuss.elastic.co/t/storing-new-elasticsearch-documents-while-restoring-an-index/152647>\
**Category:** Elasticsearch\
**Created:** [October 16, 2018, 11:58am UTC](https://discuss.elastic.co/t/storing-new-elasticsearch-documents-while-restoring-an-index/152647 "2018-10-16T11:58:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![coreation](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/coreation/32/10165_2.png) [@coreation](https://discuss.elastic.co/u/coreation)\
**Post date:** [October 16, 2018, 11:58am UTC](https://discuss.elastic.co/t/storing-new-elasticsearch-documents-while-restoring-an-index/152647/1 "2018-10-16T11:58:11Z")

</div>

Hi there,

I have a question about storing new documents in an indexed that is being restored. Is such a thing possible? My use case is that we have a large index that will be restored, but upon restoring the index we have a different process that will periodically insert new documents into that index as well. I can't figure out via the documentation if the index that is being restored is being set to read-only for example or not.

If anyone has input on this, it would be much appreciated!

---

<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:** [October 16, 2018, 6:46pm UTC](https://discuss.elastic.co/t/storing-new-elasticsearch-documents-while-restoring-an-index/152647/2 "2018-10-16T18:46:57Z")

</div>

Restoring an index from snapshot works on a shard-by-shard basis and, for each shard, takes place entirely before the primary of that shard is started. You cannot write to a shard (or search it) before its primary is started. Attempts to do so will wait for the shard to start, up to 60 seconds by default I think, and then fail. However, because the shards are all restored independently it may be possible to write to some of the shards before the others are started.

I think you can yourself set the whole index to be read-only when you start the restore process by including `"index.blocks.read_only":true` in the index settings. Once the whole index has been restored you can then remove this block to allow writes.

---

<div class="post-metadata">

**Author:** ![coreation](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/coreation/32/10165_2.png) [@coreation](https://discuss.elastic.co/u/coreation)\
**Post date:** [October 16, 2018, 7:19pm UTC](https://discuss.elastic.co/t/storing-new-elasticsearch-documents-while-restoring-an-index/152647/3 "2018-10-16T19:19:09Z")

</div>

Thanks for the reply David, much appreciated!

---

<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:** [November 13, 2018, 7:19pm UTC](https://discuss.elastic.co/t/storing-new-elasticsearch-documents-while-restoring-an-index/152647/4 "2018-11-13T19:19:10Z")

</div>

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