# Snapshot backup via api not working as expacted

**URL:** <https://discuss.elastic.co/t/snapshot-backup-via-api-not-working-as-expacted/348841>\
**Category:** Elasticsearch\
**Tags:** snapshot-and-restore\
**Created:** [December 7, 2023, 8:06pm UTC](https://discuss.elastic.co/t/snapshot-backup-via-api-not-working-as-expacted/348841 "2023-12-07T20:06:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![elasticforme](https://avatars.discourse-cdn.com/v4/letter/e/f05b48/32.png) [@elasticforme](https://discuss.elastic.co/u/elasticforme)\
**Post date:** [December 7, 2023, 8:06pm UTC](https://discuss.elastic.co/t/snapshot-backup-via-api-not-working-as-expacted/348841/1 "2023-12-07T20:06:33Z")

</div>

I am running backup via bash and it is working successfully but backing up lot of unwanted backup with it.

here is code

```auto
for indice in daily_check_index-2023
do

curl -XPUT -u ${elk_admin_user}:${elk_admin_password} "${URL}/_snapshot/${indice}/${today}?wait_for_completion=true" -H "Content-Type: application/json" -d"
{
    \"indices\": \"${indice}\",
     \"ignore_unavailable\": true
}"
done

```

this suppose to create only indices backup of "daily\_check\_index-2023" but it is also making backup of lot of hidden index with it? how do I avoid it?  
is my syntax is wrong?

for example some of the backup

`{"snapshot":{"snapshot":"07dec2023","uuid":"0XacBksBRfGFFwlgb78Wig","repository":"daily_check_index-2023","version_id":8050399,"version":"8.5.3","indices":[".kibana_4",".security-profile-8",".kibana_9",".transform-internal-007",".kibana_3",".apm-custom-link",".kibana_8.5.3_001"....]`

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [December 7, 2023, 8:57pm UTC](https://discuss.elastic.co/t/snapshot-backup-via-api-not-working-as-expacted/348841/2 "2023-12-07T20:57:27Z")

</div>

By default a create-snapshot request includes the cluster state, and therefore all feature state indices too. See [these docs](https://www.elastic.co/guide/en/elasticsearch/reference/current/create-snapshot-api.html), particularly the paragraphs on the `include_global_state` and `feature_states` options.

---

<div class="post-metadata">

**Author:** ![elasticforme](https://avatars.discourse-cdn.com/v4/letter/e/f05b48/32.png) [@elasticforme](https://discuss.elastic.co/u/elasticforme)\
**Post date:** [December 7, 2023, 9:14pm UTC](https://discuss.elastic.co/t/snapshot-backup-via-api-not-working-as-expacted/348841/3 "2023-12-07T21:14:16Z")

</div>

oh nice, I added include\_global\_state: false and all good.

---

<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:** [January 4, 2024, 9:14pm UTC](https://discuss.elastic.co/t/snapshot-backup-via-api-not-working-as-expacted/348841/4 "2024-01-04T21:14:51Z")

</div>

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