Get the snapshot status
Generally available; Added in 7.8.0
All methods and paths for this operation:
Get a detailed description of the current state for each shard participating in the snapshot.
Note that this API should be used only to obtain detailed shard-level information for ongoing snapshots. If this detail is not needed or you want to obtain information about one or more existing snapshots, use the get snapshot API.
If you omit the <snapshot>
request path parameter, the request retrieves information only for currently running snapshots.
This usage is preferred.
If needed, you can specify <repository>
and <snapshot>
to retrieve information for specific snapshots, even if they're not currently running.
Note that the stats will not be available for any shard snapshots in an ongoing snapshot completed by a node that (even momentarily) left the cluster. Loading the stats from the repository is an expensive operation (see the WARNING below). Therefore the stats values for such shards will be -1 even though the "stage" value will be "DONE", in order to minimize latency. A "description" field will be present for a shard snapshot completed by a departed node explaining why the shard snapshot's stats results are invalid. Consequently, the total stats for the index will be less than expected due to the missing values from these shards.
WARNING: Using the API to return the status of any snapshots other than currently running snapshots can be expensive. The API requires a read from the repository for each shard in each snapshot. For example, if you have 100 snapshots with 1,000 shards each, an API request that includes all snapshots will require 100,000 reads (100 snapshots x 1,000 shards).
Depending on the latency of your storage, such requests can take an extremely long time to return results. These requests can also tax machine resources and, when using cloud storage, incur high processing costs.
Required authorization
- Cluster privileges:
monitor_snapshot
Path parameters
-
The snapshot repository name used to limit the request. It supports wildcards (
*
) if<snapshot>
isn't specified. -
A comma-separated list of snapshots to retrieve status for. The default is currently running snapshots. Wildcards (
*
) are not supported.
GET _snapshot/my_repository/snapshot_2/_status
resp = client.snapshot.status(
repository="my_repository",
snapshot="snapshot_2",
)
const response = await client.snapshot.status({
repository: "my_repository",
snapshot: "snapshot_2",
});
response = client.snapshot.status(
repository: "my_repository",
snapshot: "snapshot_2"
)
$resp = $client->snapshot()->status([
"repository" => "my_repository",
"snapshot" => "snapshot_2",
]);
curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_snapshot/my_repository/snapshot_2/_status"
client.snapshot().status(s -> s
.repository("my_repository")
.snapshot("snapshot_2")
);
{
"snapshots" : [
{
"snapshot" : "snapshot_2",
"repository" : "my_repository",
"uuid" : "lNeQD1SvTQCqqJUMQSwmGg",
"state" : "SUCCESS",
"include_global_state" : false,
"shards_stats" : {
"initializing" : 0,
"started" : 0,
"finalizing" : 0,
"done" : 1,
"failed" : 0,
"total" : 1
},
"stats" : {
"incremental" : {
"file_count" : 3,
"size_in_bytes" : 5969
},
"total" : {
"file_count" : 4,
"size_in_bytes" : 6024
},
"start_time_in_millis" : 1594829326691,
"time_in_millis" : 205
},
"indices" : {
"index_1" : {
"shards_stats" : {
"initializing" : 0,
"started" : 0,
"finalizing" : 0,
"done" : 1,
"failed" : 0,
"total" : 1
},
"stats" : {
"incremental" : {
"file_count" : 3,
"size_in_bytes" : 5969
},
"total" : {
"file_count" : 4,
"size_in_bytes" : 6024
},
"start_time_in_millis" : 1594829326896,
"time_in_millis" : 0
},
"shards" : {
"0" : {
"stage" : "DONE",
"stats" : {
"incremental" : {
"file_count" : 3,
"size_in_bytes" : 5969
},
"total" : {
"file_count" : 4,
"size_in_bytes" : 6024
},
"start_time_in_millis" : 1594829326896,
"time_in_millis" : 0
}
}
}
}
}
}
]
}
{
"snapshots" : [
{
"snapshot" : "snapshot_2",
"repository" : "my_repository",
"uuid" : "lNeQD1SvTQCqqJUMQSwmGg",
"state" : "STARTED",
"include_global_state" : true,
"shards_stats" : {
"initializing" : 0,
"started" : 1,
"finalizing" : 0,
"done" : 1,
"failed" : 0,
"total" : 2
},
"stats" : {
"incremental" : {
"file_count" : 4,
"size_in_bytes" : 5412
},
"processed" : {
"file_count" : 2,
"size_in_bytes" : 658
},
"total" : {
"file_count" : 4,
"size_in_bytes" : 5412
},
"start_time_in_millis" : 1750452674327,
"time_in_millis" : 189
},
"indices" : {
"index-1" : {
"shards_stats" : {
"initializing" : 0,
"started" : 1,
"finalizing" : 0,
"done" : 0,
"failed" : 0,
"total" : 1
},
"stats" : {
"incremental" : {
"file_count" : 4,
"size_in_bytes" : 5412
},
"processed" : {
"file_count" : 2,
"size_in_bytes" : 658
},
"total" : {
"file_count" : 4,
"size_in_bytes" : 5412
},
"start_time_in_millis" : 1750452674379,
"time_in_millis" : 0
},
"shards" : {
"0" : {
"stage" : "STARTED",
"stats" : {
"incremental" : {
"file_count" : 4,
"size_in_bytes" : 5412
},
"processed" : {
"file_count" : 2,
"size_in_bytes" : 658
},
"total" : {
"file_count" : 4,
"size_in_bytes" : 5412
},
"start_time_in_millis" : 1750452674379,
"time_in_millis" : 0
},
"node" : "VJzy6aKJSVKwcfjIFBPXxw"
}
}
},
"index-2" : {
"shards_stats" : {
"initializing" : 0,
"started" : 0,
"finalizing" : 0,
"done" : 1,
"failed" : 0,
"total" : 1
},
"stats" : {
"incremental" : {
"file_count" : 0,
"size_in_bytes" : 0
},
"total" : {
"file_count" : 0,
"size_in_bytes" : 0
},
"start_time_in_millis" : 0,
"time_in_millis" : 0
},
"shards" : {
"0" : {
"stage" : "DONE",
"stats" : {
"incremental" : {
"file_count" : -1,
"size_in_bytes" : -1
},
"total" : {
"file_count" : -1,
"size_in_bytes" : -1
},
"start_time_in_millis" : 0,
"time_in_millis" : 0
},
"description" : "Snapshot shard stats missing from a currently running snapshot due to a node leaving the cluster after completing the shard snapshot; retry once the snapshot has completed to load all shard stats from the repository."
}
}
}
}
}
]
}