# Selectively choosing documents from an index to include in a snapshot

**URL:** <https://discuss.elastic.co/t/selectively-choosing-documents-from-an-index-to-include-in-a-snapshot/301764>\
**Category:** Elasticsearch\
**Tags:** snapshot-and-restore\
**Created:** [April 6, 2022, 1:43pm UTC](https://discuss.elastic.co/t/selectively-choosing-documents-from-an-index-to-include-in-a-snapshot/301764 "2022-04-06T13:43:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hishamnajem](https://avatars.discourse-cdn.com/v4/letter/h/7ba0ec/32.png) [@hishamnajem](https://discuss.elastic.co/u/hishamnajem)\
**Post date:** [April 6, 2022, 1:43pm UTC](https://discuss.elastic.co/t/selectively-choosing-documents-from-an-index-to-include-in-a-snapshot/301764/1 "2022-04-06T13:43:56Z")

</div>

Hello, is there a way within a single operation selectively include only some documents (based on a filter) when creating a snapshot?

For example if I have an index named index-1 and it has 1000 docs of which 100 include [error] in them, can I selectively only choose those 100 docs to include in the snapshot?  
If NOT, and assuming I have a snapshot of all 1000 docs from index-1, can I selectively restore those 100 docs which include [error] in them?

If there is not a single operation (included within the create or restore snapshot) I am assuming I can just reindex index-1 and include a filter to selectively grab the docs I want.

---

<div class="post-metadata">

**Author:** ![RabBit\_BR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rabbit_br/32/82261_2.png) [@RabBit\_BR](https://discuss.elastic.co/u/RabBit_BR)\
**Post date:** [April 6, 2022, 2:24pm UTC](https://discuss.elastic.co/t/selectively-choosing-documents-from-an-index-to-include-in-a-snapshot/301764/2 "2022-04-06T14:24:22Z")

</div>

I studied the snapshot and didn't find anything like what you want.  
I think as you said, you must create a new index with the filtered docs and perform the snapshot from it.

Maybe an Elastic member might suggest another solution.

---

<div class="post-metadata">

**Author:** ![hishamnajem](https://avatars.discourse-cdn.com/v4/letter/h/7ba0ec/32.png) [@hishamnajem](https://discuss.elastic.co/u/hishamnajem)\
**Post date:** [April 7, 2022, 2:15pm UTC](https://discuss.elastic.co/t/selectively-choosing-documents-from-an-index-to-include-in-a-snapshot/301764/3 "2022-04-07T14:15:21Z")

</div>

I think you're right. The API is pretty clear, just thought there was a way to combine two operations (taking a snap and filtering) into one.

---

<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:** [May 5, 2022, 2:15pm UTC](https://discuss.elastic.co/t/selectively-choosing-documents-from-an-index-to-include-in-a-snapshot/301764/4 "2022-05-05T14:15:23Z")

</div>

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