# Is it possible to only restore the incremental portion of snapshot?

**URL:** <https://discuss.elastic.co/t/is-it-possible-to-only-restore-the-incremental-portion-of-snapshot/96495>\
**Category:** Elasticsearch\
**Created:** [August 9, 2017, 7:03pm UTC](https://discuss.elastic.co/t/is-it-possible-to-only-restore-the-incremental-portion-of-snapshot/96495 "2017-08-09T19:03:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![fate9834](https://avatars.discourse-cdn.com/v4/letter/f/96bed5/32.png) [@fate9834](https://discuss.elastic.co/u/fate9834)\
**Post date:** [August 9, 2017, 7:03pm UTC](https://discuss.elastic.co/t/is-it-possible-to-only-restore-the-incremental-portion-of-snapshot/96495/1 "2017-08-09T19:03:13Z")

</div>

Continuing the discussion from [Incremental Snapshot / Restore](https://discuss.elastic.co/t/incremental-snapshot-restore/28282/6):

The example from David was:

Snapshot1 pushed segments 1, 2, 3 in repository X  
Snapshot2 needs to backup segments 1, 2, 3, 4 (4 contains the new data). But repository X already has segments 1, 2, 3. So the \_snapshot action will only copy for snapshot2 the segment 4.

Let's say I have two Elasticsearch clusters, A & B.  
At time 0, I created Snapshot1 at A. It contains segment 1, 2, 3.  
At time 1, I restored Snapshot1 at B. B now has segment 1, 2, 3.  
At time 2, I created the incremental Snapshot2. it contains segment 1, 2, 3, 4.

Now, is it possible that I restore Snapshot2 at B, when B already contains segment 1,2,3?  
If yes, will it restore segment 4 only? Or will it destroy all indexes in B first, and then restore segment 1, 2, 3, 4?

Thanks!

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [August 11, 2017, 1:23pm UTC](https://discuss.elastic.co/t/is-it-possible-to-only-restore-the-incremental-portion-of-snapshot/96495/2 "2017-08-11T13:23:26Z")

</div>

> [@fate9834](#):
>
> Now, is it possible that I restore Snapshot2 at B, when B already contains segment 1,2,3?
> 
> If yes, will it restore segment 4 only? Or will it destroy all indexes in B first, and then restore segment 1, 2, 3, 4?

Yes, in most cases we will only restore segment 4. You need to be careful though, if the primary and replica flip on A for whatever reason, the new primary (former replica) might have a completely different set of segments. In this case we are going to overwrite all files.

---

<div class="post-metadata">

**Author:** ![fate9834](https://avatars.discourse-cdn.com/v4/letter/f/96bed5/32.png) [@fate9834](https://discuss.elastic.co/u/fate9834)\
**Post date:** [August 11, 2017, 4:48pm UTC](https://discuss.elastic.co/t/is-it-possible-to-only-restore-the-incremental-portion-of-snapshot/96495/3 "2017-08-11T16:48:36Z")

</div>

Hi Igor, Thanks for your response! I have two more questions 😃

In [documentation of Snapshot & Restore](https://www.elastic.co/guide/en/elasticsearch/reference/1.7/modules-snapshots.html):

"The restore operation can be performed on a functioning cluster. However, an existing index can be only restored if it’s closed and has the same number of shards as the index in the snapshot. The restore operation automatically opens restored indices if they were closed"

My first question is: if an existing index _index1_ in my cluster B is re-opened by the Restore operation, during the Restore operation is running, is it possible to keep writing new documents into _index1_?

My second question is: if I'm not adding any new Elasticsearch nodes, will all existing indices be stable? Could you please, briefly, give an example where the shards can flip in that case?

Thanks!

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [August 11, 2017, 5:30pm UTC](https://discuss.elastic.co/t/is-it-possible-to-only-restore-the-incremental-portion-of-snapshot/96495/4 "2017-08-11T17:30:05Z")

</div>

> [@fate9834](#):
>
> My first question is: if an existing index index1 in my cluster B is re-opened by the Restore operation, during the Restore operation is running, is it possible to keep writing new documents into index1?

No, during the restore operation the restored index is going to be in the `RED` state and until shards are fully restored from the snapshot all write and read operations against restored shards are going to fail.

> [@fate9834](#):
>
> My second question is: if I’m not adding any new Elasticsearch nodes, will all existing indices be stable? Could you please, briefly, give an example where the shards can flip in that case?

A replica shard will become primary if the node with the primary shard dies or disconnects from the cluster.

---

<div class="post-metadata">

**Author:** ![fate9834](https://avatars.discourse-cdn.com/v4/letter/f/96bed5/32.png) [@fate9834](https://discuss.elastic.co/u/fate9834)\
**Post date:** [August 11, 2017, 6:55pm UTC](https://discuss.elastic.co/t/is-it-possible-to-only-restore-the-incremental-portion-of-snapshot/96495/5 "2017-08-11T18:55:12Z")

</div>

Thank you so much for the answer!

---

<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:** [September 8, 2017, 6:55pm UTC](https://discuss.elastic.co/t/is-it-possible-to-only-restore-the-incremental-portion-of-snapshot/96495/6 "2017-09-08T18:55:13Z")

</div>

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