Hi,
I was trying to take snapshot of all indices but it looks like close indices are omitted from snapshot until specified explicitly with name.
This what I did. I created two indices and injected some dummy documents into them. And closed one index.
% curl localhost:9200/_cat/indices?v
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
yellow close twitter cpSNr17-T4C952qjOncUZQ 3 2
yellow open facebook ZlACnCrxTluRwHR40Q2kyQ 3 2 2 0 8.8kb 8.8kb
You can see that twitter index is closed but facebook is open.
Now I tried to create snapshot by following commands
% curl -X PUT "localhost:9200/_snapshot/my_backup/test_close2" -H 'Content-Type: application/json' -d'
{
"indices": "*"
}'
and also by this:
curl -X PUT "localhost:9200/_snapshot/my_backup/snapshot_1?wait_for_completion=true&pretty"
In both of the ways twitter index was not included in indices that were snapshotted
Proof:
% curl -X GET "localhost:9200/_snapshot/my_backup/test_close2?pretty"
{
"snapshots" : [
{
"snapshot" : "test_close2",
"uuid" : "-zEn7E8-RqiHIQ5JB7S-Ug",
"version_id" : 7040299,
"version" : "7.4.2",
"indices" : [
"facebook"
],
"include_global_state" : true,
"state" : "SUCCESS",
"start_time" : "2020-05-26T11:26:47.498Z",
"start_time_in_millis" : 1590492407498,
"end_time" : "2020-05-26T11:26:47.698Z",
"end_time_in_millis" : 1590492407698,
"duration_in_millis" : 200,
"failures" : [ ],
"shards" : {
"total" : 3,
"failed" : 0,
"successful" : 3
}
}
]
}
% curl -X GET "localhost:9200/_snapshot/my_backup/snapshot_1?pretty"
{
"snapshots" : [
{
"snapshot" : "snapshot_1",
"uuid" : "umRMmuKsQDycx9v-nCenEA",
"version_id" : 7040299,
"version" : "7.4.2",
"indices" : [
"facebook"
],
"include_global_state" : true,
"state" : "SUCCESS",
"start_time" : "2020-05-26T11:16:14.258Z",
"start_time_in_millis" : 1590491774258,
"end_time" : "2020-05-26T11:16:14.258Z",
"end_time_in_millis" : 1590491774258,
"duration_in_millis" : 0,
"failures" : [ ],
"shards" : {
"total" : 3,
"failed" : 0,
"successful" : 3
}
}
]
}
From the above snapshots API response you can see that closed index twitter is not included in any of the above snapshot taken(test_close2 and snapshot_1)
But interestingly if we specifically add twitter
(which the closed index) in the indices then snapshot is taken for that index
% curl -X PUT "localhost:9200/_snapshot/my_backup/test_close" -H 'Content-Type: application/json' -d'
{
"indices": "twitter"
}'
Snapshot GET API repsonse for the above snapshot:
curl -X GET "localhost:9200/_snapshot/my_backup/test_close?pretty"
{
"snapshots" : [
{
"snapshot" : "test_close",
"uuid" : "cekfChOsRlmqKQlWjs1dlw",
"version_id" : 7040299,
"version" : "7.4.2",
"indices" : [
"twitter"
],
"include_global_state" : true,
"state" : "SUCCESS",
"start_time" : "2020-05-26T11:18:45.115Z",
"start_time_in_millis" : 1590491925115,
"end_time" : "2020-05-26T11:18:45.316Z",
"end_time_in_millis" : 1590491925316,
"duration_in_millis" : 201,
"failures" : [ ],
"shards" : {
"total" : 3,
"failed" : 0,
"successful" : 3
}
}
]
}
You can find twitter
index being snapshoted in test_close
snapshot
I wanted to know is this expected behavior?
If yes, wont you think snapshot API should also include a parameter to specify that include close indices as well while taking snapshot
If there is already a way please let me know?