What can I expect after restoring a snapshot?

I have put in place a snapshot restoration process. It's great, but I've chosen to delete the indices first (as opposed to 'closing' them). The reason I took this approach is because it is easy to know what data will exist after the process is complete: the data from the snapshot. However, the question still remains (to me) and I cannot see the answer in the docs or online.

What data will be around after restoring a snapshot with having closed the indices? Will docs written AFTER the snapshot still be present?

I'd like to know exactly what set of data will be around in this case. Please and thank you.

Will docs written AFTER the snapshot still be present?

Documents written where? To which index? Snapshot is a copy of the index at a given point of time, any changes to the index after that will not be present in the snapshot.

Hi. Thanks.
Yes, that much is clear. Data written after the snapshot wont be in the snapshot. I was asking about what data will be present in the ES cluster after the snapshot is restored.

Rephrased: If docs exist in the cluster that were written AFTER the snapshot was taken, what will happen to them once I restore said snapshot?

I'll try to explain with an example,

Assume Cluster CL-A has indices IND-1, IND-2, IND-3 and index IND-2 has documents DOC-1, DOC-2, DOC-3.

You took a snapshot SNP of index IND-2. After taking the snapshot, you add another document DOC-4 to index IND-2.

Now, if you were to try and restore the snapshot SNP in cluster CL-A then (as per my knowledge) Elasticsearch will thrown an error saying index with name IND-2 already exists and won't restore the snapshot. Alternatively, If you were to restore with a different name (IND-4) then your cluster will have indices IND-1, IND-2, IND-3, IND-4 wherein IND-4 will have documents DOC-1, DOC-2, DOC-3 and index IND-2 will have documents DOC-1, DOC-2, DOC-3, DOC-4.

In short, a restore of snapshot will not affect any existing index or documents within those indices.

Thanks for your help, but I think there is an error here. I believe you definitely can restore a snapshot on an existing index as long as it's closed.

https://www.elastic.co/guide/en/elasticsearch/reference/current/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 and creates new indices if they didn’t exist in the cluster.

So I think, the question remains: if I do this, what set of data will be in the cluster afterwards.

Aha. Completely skipped that line. I stand corrected, thanks for pointing that out. Onto your issue, this github issue - Restore of an existing index doesn’t restore mappings and settings might give you some idea of expected behavior.

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