# Snapshot data based on query

**URL:** <https://discuss.elastic.co/t/snapshot-data-based-on-query/200559>\
**Category:** Elasticsearch\
**Created:** [September 22, 2019, 7:37am UTC](https://discuss.elastic.co/t/snapshot-data-based-on-query/200559 "2019-09-22T07:37:17Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![sanju\_yadav](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sanju_yadav/32/54664_2.png) [@sanju\_yadav](https://discuss.elastic.co/u/sanju_yadav)\
**Post date:** [September 22, 2019, 7:37am UTC](https://discuss.elastic.co/t/snapshot-data-based-on-query/200559/1 "2019-09-22T07:37:17Z")

</div>

I have a big index containing data of last 3 years, now I want to implement snapshot to solve and data mishap, I want to include only last 3 months data in snapshot and after that move to incremental snapshot, can I do this?

---

<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:** [September 22, 2019, 8:02am UTC](https://discuss.elastic.co/t/snapshot-data-based-on-query/200559/2 "2019-09-22T08:02:55Z")

</div>

Snapshots work at the index level copying complete segments, so if all your data is in a single index you will need to snapshot all of it.

---

<div class="post-metadata">

**Author:** ![sanju\_yadav](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sanju_yadav/32/54664_2.png) [@sanju\_yadav](https://discuss.elastic.co/u/sanju_yadav)\
**Post date:** [September 27, 2019, 7:06am UTC](https://discuss.elastic.co/t/snapshot-data-based-on-query/200559/3 "2019-09-27T07:06:14Z")

</div>

thanks

---

<div class="post-metadata">

**Author:** ![sanju\_yadav](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sanju_yadav/32/54664_2.png) [@sanju\_yadav](https://discuss.elastic.co/u/sanju_yadav)\
**Post date:** [September 30, 2019, 5:37am UTC](https://discuss.elastic.co/t/snapshot-data-based-on-query/200559/4 "2019-09-30T05:37:31Z")

</div>

why elastic search does not provide snapshot based on the timestamp query like mysql get snapshot of data created before some date, I am not able to understand this. Please share your thoughts on the same

---

<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:** [September 30, 2019, 5:45am UTC](https://discuss.elastic.co/t/snapshot-data-based-on-query/200559/5 "2019-09-30T05:45:35Z")

</div>

Elasticsearch often handle considerably larger data volumes than yuor typical relational databases like MySQL does. I have seen clusters with over a petabyte of data. In order to take backups at that scale the backup process must be efficient in terms of computation and disk I/O and retrieving documents based on a query is much, much more expensive (results in lots of random access disk reads due to how Lucene works) than copying the full segments/index files that Lucene creates, which basically is what the snapshot/restore mechanism does.

In your case you could reindex the last 3 months based on a query into a new index/set of time-based indices and then remove the current index. If you have a large data volume this is likely to take time and result in a lot of disk I/O.

---

<div class="post-metadata">

**Author:** ![sanju\_yadav](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sanju_yadav/32/54664_2.png) [@sanju\_yadav](https://discuss.elastic.co/u/sanju_yadav)\
**Post date:** [October 1, 2019, 5:16am UTC](https://discuss.elastic.co/t/snapshot-data-based-on-query/200559/6 "2019-10-01T05:16:31Z")

</div>

thanks

---

<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:** [October 29, 2019, 5:17am UTC](https://discuss.elastic.co/t/snapshot-data-based-on-query/200559/7 "2019-10-29T05:17:42Z")

</div>

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