# How can I Exclude indices from elasticsearch snapshots

**URL:** <https://discuss.elastic.co/t/how-can-i-exclude-indices-from-elasticsearch-snapshots/184317>\
**Category:** Elasticsearch\
**Created:** [June 5, 2019, 9:36am UTC](https://discuss.elastic.co/t/how-can-i-exclude-indices-from-elasticsearch-snapshots/184317 "2019-06-05T09:36:42Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![nuwan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nuwan/32/42325_2.png) [@nuwan](https://discuss.elastic.co/u/nuwan)\
**Post date:** [June 5, 2019, 9:36am UTC](https://discuss.elastic.co/t/how-can-i-exclude-indices-from-elasticsearch-snapshots/184317/1 "2019-06-05T09:36:43Z")

</div>

I need to exclude a few indices from an elastic snapshot, in the documentation for snapshots , they mention you can include what indices you need, but I need it another way around because I need to snapshot all indices except a few.

Snapshot syntax supports [multi-index](https://www.elastic.co/guide/en/elasticsearch/reference/current/multi-index.html) syntax, Hence you can exclude them with `-` before indice name.

**Please let me know the curl command for taking snapshot**

Thank you

---

<div class="post-metadata">

**Author:** ![thekm1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thekm1/32/35926_2.png) [@thekm1](https://discuss.elastic.co/u/thekm1)\
**Post date:** [June 5, 2019, 9:45am UTC](https://discuss.elastic.co/t/how-can-i-exclude-indices-from-elasticsearch-snapshots/184317/2 "2019-06-05T09:45:23Z")

</div>

Hi @nuwan  
Can you provide the curl command which you used or tried to use?

---

<div class="post-metadata">

**Author:** ![nuwan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nuwan/32/42325_2.png) [@nuwan](https://discuss.elastic.co/u/nuwan)\
**Post date:** [June 5, 2019, 9:51am UTC](https://discuss.elastic.co/t/how-can-i-exclude-indices-from-elasticsearch-snapshots/184317/3 "2019-06-05T09:51:01Z")

</div>

> [@nuwan](#):
>
> I need to exclude a few indices from an elastic snapshot, in the documentation for snapshots , they mention you can include what indices you need, but I need it another way around because I need to snapshot all indices except a few.

curl -XPUT "[http://172.24.36.204:9200/\_snapshot/first\_backup/nuwan?wait\_for\_completion=true](http://172.24.36.204:9200/_snapshot/first_backup/nuwan?wait_for_completion=true)"

---

<div class="post-metadata">

**Author:** ![nuwan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nuwan/32/42325_2.png) [@nuwan](https://discuss.elastic.co/u/nuwan)\
**Post date:** [June 5, 2019, 9:51am UTC](https://discuss.elastic.co/t/how-can-i-exclude-indices-from-elasticsearch-snapshots/184317/4 "2019-06-05T09:51:25Z")

</div>

curl -XPUT "[http://172.24.36.204:9200/\_snapshot/first\_backup/nuwan?wait\_for\_completion=true](http://172.24.36.204:9200/_snapshot/first_backup/nuwan?wait_for_completion=true)"

---

<div class="post-metadata">

**Author:** ![thekm1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thekm1/32/35926_2.png) [@thekm1](https://discuss.elastic.co/u/thekm1)\
**Post date:** [June 5, 2019, 9:55am UTC](https://discuss.elastic.co/t/how-can-i-exclude-indices-from-elasticsearch-snapshots/184317/5 "2019-06-05T09:55:08Z")

</div>

@nuwan Thank you.  
I think you can do this as you mentioned with `-`  
It should look something like this.

> curl -X PUT "localhost:9200/\_snapshot/my\_backup/snapshot\_2?wait\_for\_completion=true" -H 'Content-Type: application/json' -d'  
> {  
> "indices": "-index\_1,-index\_2",  
> "ignore\_unavailable": true,  
> "include\_global\_state": false  
> }  
> '

This command should exclude `index_1` and `index_2`  
Thank you for the feedback if this worked for you.

---

<div class="post-metadata">

**Author:** ![nuwan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nuwan/32/42325_2.png) [@nuwan](https://discuss.elastic.co/u/nuwan)\
**Post date:** [June 5, 2019, 10:04am UTC](https://discuss.elastic.co/t/how-can-i-exclude-indices-from-elasticsearch-snapshots/184317/6 "2019-06-05T10:04:30Z")

</div>

Thank you very much I will let you know the status once I test it.

---

<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 3, 2019, 10:04am UTC](https://discuss.elastic.co/t/how-can-i-exclude-indices-from-elasticsearch-snapshots/184317/7 "2019-07-03T10:04:33Z")

</div>

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