How can I Exclude indices from elasticsearch snapshots

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 syntax, Hence you can exclude them with - before indice name.

Please let me know the curl command for taking snapshot

Thank you

1 Like

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

curl -XPUT "http://172.24.36.204:9200/_snapshot/first_backup/nuwan?wait_for_completion=true"

curl -XPUT "http://172.24.36.204:9200/_snapshot/first_backup/nuwan?wait_for_completion=true"

@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.

1 Like

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

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