# Incremental Snapshot / Restore

**URL:** <https://discuss.elastic.co/t/incremental-snapshot-restore/28282>\
**Category:** Elasticsearch\
**Created:** [August 29, 2015, 12:46pm UTC](https://discuss.elastic.co/t/incremental-snapshot-restore/28282 "2015-08-29T12:46:38Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![dimalini](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dimalini/32/22448_2.png) [@dimalini](https://discuss.elastic.co/u/dimalini)\
**Post date:** [August 29, 2015, 12:46pm UTC](https://discuss.elastic.co/t/incremental-snapshot-restore/28282/1 "2015-08-29T12:46:38Z")

</div>

Hi,

I am trying out the snapshot/restore feature in ES. I did the following  
(1) Registered one of my local directory as repo  
(2) Took snapshot of indexed data using command PUT /\_snapshot/repo1/snapshot1  
(3) Made modifications and re-indexed my original data  
(4) Took another snapshot PUT /\_snapshot/repo1/snapshot2  
(5) (a) Deleted my index that had all the data. restored snap2 -  
(b) Deleted my index that had all the data. Deleted snap 1. Restored snap2 -

If i understood it right , snap2 is by default , an incremental snapshot. Both for 5 (a) and 5 (b) i see all my data as expected. My question here is ,  
Should restoring snap2 not just restore the delta it is aware of and how is it able to restore all data ? Even when i had deleted snap1 how was it able to recover all files ? Could someone explain the incremental concept better ?

Kindly help ...

Thanks in advance !!

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [August 29, 2015, 1:31pm UTC](https://discuss.elastic.co/t/incremental-snapshot-restore/28282/2 "2015-08-29T13:31:44Z")

</div>

If you snapshot a second time in `snapshot1` then you will copy only the delta. It's incremental in that way.

If you create another snapshot `snapshot2`, then you are doing again a full backup.

That said, your test is strange to me. `snapshot1` should not contain the new data when you restored it.

---

<div class="post-metadata">

**Author:** ![dimalini](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dimalini/32/22448_2.png) [@dimalini](https://discuss.elastic.co/u/dimalini)\
**Post date:** [August 31, 2015, 4:41am UTC](https://discuss.elastic.co/t/incremental-snapshot-restore/28282/3 "2015-08-31T04:41:23Z")

</div>

Thanks for the reply David !!

Basically, i was trying out this scenario, to figure out if i can implement a cleanup policy that cleans up those snapshots created before a particular date

As per your clarification, if i try to snapshot a second time in "snapshot1" ,i see this exception  
{  
"error": "InvalidSnapshotNameException[[repo1:snapshot1] Invalid snapshot name [snapshot1], snapshot with such name already exists]",  
"status": 400  
}

How do i mention that this is incremental ? Am i missing something ?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [August 31, 2015, 6:17am UTC](https://discuss.elastic.co/t/incremental-snapshot-restore/28282/4 "2015-08-31T06:17:18Z")

</div>

Yeah sorry. I was wrong.  
You need to create a new SNAPSHOT each time you want to backup.

Each Snapshot has a list of segments. When you create a new Snapshot only new segments are copied.

The repository contains the full backup.

If you restore snapshot2, you will restore the latest version. If you restore snapshot1 you should see only the first data.

Make sense?

---

<div class="post-metadata">

**Author:** ![dimalini](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dimalini/32/22448_2.png) [@dimalini](https://discuss.elastic.co/u/dimalini)\
**Post date:** [August 31, 2015, 6:59am UTC](https://discuss.elastic.co/t/incremental-snapshot-restore/28282/5 "2015-08-31T06:59:35Z")

</div>

Yes David, it does.

So if i understood it right, the expectation is ,  
-\> if I restore snap2 i should see only new segments(my observation was different though, i could see both old and new segments) ?

In my initial post i had mentioned the steps i followed. And this was my Q:  
Should restoring snap2 not just restore the delta it is aware of and how is it able to restore all data ? Even when i had deleted snap1 how was it able to recover all files ?

Please clarify...

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [August 31, 2015, 7:20am UTC](https://discuss.elastic.co/t/incremental-snapshot-restore/28282/6 "2015-08-31T07:20:12Z")

</div>

No.

Let me explain with an example:

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.

When you delete the snapshot1, as snapshot2 also has links to segments 1, 2, 3 those files are not removed.

When you restore snapshot2, you restore all files linked: segments 1, 2, 3 and 4.

Make sense?

---

<div class="post-metadata">

**Author:** ![dimalini](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dimalini/32/22448_2.png) [@dimalini](https://discuss.elastic.co/u/dimalini)\
**Post date:** [August 31, 2015, 7:53am UTC](https://discuss.elastic.co/t/incremental-snapshot-restore/28282/7 "2015-08-31T07:53:17Z")

</div>

Makes sense , Thank you David !!!

---

<div class="post-metadata">

**Author:** ![r.ganeshbabu](https://avatars.discourse-cdn.com/v4/letter/r/4da419/32.png) [@r.ganeshbabu](https://discuss.elastic.co/u/r.ganeshbabu)\
**Post date:** [January 11, 2016, 11:47am UTC](https://discuss.elastic.co/t/incremental-snapshot-restore/28282/8 "2016-01-11T11:47:08Z")

</div>

Hi @dadoonet,

Snapshot1 took in PROD for es\_item index and restored in DR (Diaster Recovery) server for backup purpose.

I took Snapshot2 of same es\_item index\*\*(Snapshot will be incremental)\*\*.

**How can we find the difference between snapshot 1 & snapshot 2(Incremental)?**

Thanks,  
Ganeshbabu R

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 11, 2016, 12:01pm UTC](https://discuss.elastic.co/t/incremental-snapshot-restore/28282/9 "2016-01-11T12:01:00Z")

</div>

I don't really know. I mean that files which have been used by snapshots are stored in a metadata file IIRC.

The question is more: "what do you exactly want to know"?

You have to understand that snapshot backups "shards" and not individual documents. So the difference you are looking after won't tell you which documents have been backup'ed on the second run.

Makes sense?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [January 11, 2016, 12:07pm UTC](https://discuss.elastic.co/t/incremental-snapshot-restore/28282/10 "2016-01-11T12:07:53Z")

</div>

This [blog post](https://www.elastic.co/blog/found-elasticsearch-snapshot-and-restore) describes how it works quite well.

---

<div class="post-metadata">

**Author:** ![r.ganeshbabu](https://avatars.discourse-cdn.com/v4/letter/r/4da419/32.png) [@r.ganeshbabu](https://discuss.elastic.co/u/r.ganeshbabu)\
**Post date:** [January 11, 2016, 12:54pm UTC](https://discuss.elastic.co/t/incremental-snapshot-restore/28282/11 "2016-01-11T12:54:46Z")

</div>

Thanks for your response @dadoonet

Please check the below url, in which I want to know the difference of snapshots.

> [@Snapshot & Restore clarification](https://discuss.elastic.co/t/snapshot-restore-clarification/38866):
>
> Hi all, We are using Elasticsearch 1.7.2 in Prod and having 3 master nodes, 3 data nodes & 1 client node. ES cluster has 3 indices such as, Index name Primary size Shards es\_chr, 2 GB 1 es\_cval 173 GB 6 es\_item 850 GB 18 Yesterday we took snapshot in Production cluster and I can see in repository snapshot files/folders were generated with based on the number of shards allotted and then we restored…

In my scenario, If I know I can able to find the difference of snapshots I can workaround some activities to backup the prod data.

Pease check it and let me know your feedback.

Thanks,  
Ganeshbabu R

---

<div class="post-metadata">

**Author:** ![r.ganeshbabu](https://avatars.discourse-cdn.com/v4/letter/r/4da419/32.png) [@r.ganeshbabu](https://discuss.elastic.co/u/r.ganeshbabu)\
**Post date:** [January 11, 2016, 12:56pm UTC](https://discuss.elastic.co/t/incremental-snapshot-restore/28282/12 "2016-01-11T12:56:18Z")

</div>

Thanks for this reference @Christian_Dahlqvist

I clearly understood the snapshot were taken completely based on file levels

Regards,  
Ganeshbabu R

---

<div class="post-metadata">

**Author:** ![Mohammad\_Shahjahan](https://avatars.discourse-cdn.com/v4/letter/m/8baadc/32.png) [@Mohammad\_Shahjahan](https://discuss.elastic.co/u/Mohammad_Shahjahan)\
**Post date:** [April 19, 2017, 8:05am UTC](https://discuss.elastic.co/t/incremental-snapshot-restore/28282/13 "2017-04-19T08:05:45Z")

</div>

This is missing from documentation. Saved my day!

---

<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:01pm UTC](https://discuss.elastic.co/t/incremental-snapshot-restore/28282/14 "2017-07-05T22:01:02Z")

</div>


