mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-28 17:34:17 -04:00
Makes several changes to consolidate snapshot and backup-related docs. Highlights: * Adds info about supported ESS snapshot repository types * Adds docs for Kibana's Snapshot and Restore feature * Combines tutorial pages related to taking and managing snapshots * Consolidates explanations of the snapshot process * Incorporates SLM into the snapshot tutorial * Removes duplicate "back up a cluster" pages
129 lines
3.3 KiB
Text
129 lines
3.3 KiB
Text
[role="xpack"]
|
|
[[slm-api-get-policy]]
|
|
=== Get snapshot lifecycle policy API
|
|
++++
|
|
<titleabbrev>Get policy</titleabbrev>
|
|
++++
|
|
|
|
Retrieves one or more snapshot lifecycle policy definitions and
|
|
information about the latest snapshot attempts.
|
|
|
|
[[slm-api-get-request]]
|
|
==== {api-request-title}
|
|
|
|
`GET _slm/policy/<policy-id>`
|
|
|
|
`GET _slm/policy`
|
|
|
|
[[slm-api-get-lifecycle-prereqs]]
|
|
==== {api-prereq-title}
|
|
|
|
If the {es} {security-features} are enabled, you must have the `manage_slm`
|
|
cluster privilege to use this API. For more information, see
|
|
<<security-privileges>>.
|
|
|
|
[[slm-api-get-desc]]
|
|
==== {api-description-title}
|
|
|
|
Returns the specified policy definition and
|
|
information about the latest successful and failed attempts to create snapshots.
|
|
If no policy is specified, returns all defined policies.
|
|
|
|
[[slm-api-get-path-params]]
|
|
==== {api-path-parms-title}
|
|
|
|
`<policy-id>`::
|
|
(Optional, string)
|
|
Comma-separated list of snapshot lifecycle policy IDs.
|
|
|
|
[[slm-api-get-example]]
|
|
==== {api-examples-title}
|
|
|
|
[[slm-api-get-specific-ex]]
|
|
===== Get a specific policy
|
|
|
|
////
|
|
[source,console]
|
|
----
|
|
PUT _slm/policy/daily-snapshots
|
|
{
|
|
"schedule": "0 30 1 * * ?",
|
|
"name": "<daily-snap-{now/d}>",
|
|
"repository": "my_repository",
|
|
"config": {
|
|
"indices": ["data-*", "important"],
|
|
"ignore_unavailable": false,
|
|
"include_global_state": false
|
|
},
|
|
"retention": {
|
|
"expire_after": "30d",
|
|
"min_count": 5,
|
|
"max_count": 50
|
|
}
|
|
}
|
|
----
|
|
// TEST[setup:setup-repository]
|
|
////
|
|
|
|
Get the `daily-snapshots` policy:
|
|
|
|
[source,console]
|
|
----
|
|
GET _slm/policy/daily-snapshots?human
|
|
----
|
|
// TEST[continued]
|
|
|
|
This request returns the following response:
|
|
|
|
[source,console-result]
|
|
----
|
|
{
|
|
"daily-snapshots": {
|
|
"version": 1, <1>
|
|
"modified_date": "2099-05-06T01:30:00.000Z", <2>
|
|
"modified_date_millis": 4081757400000,
|
|
"policy" : {
|
|
"schedule": "0 30 1 * * ?",
|
|
"name": "<daily-snap-{now/d}>",
|
|
"repository": "my_repository",
|
|
"config": {
|
|
"indices": ["data-*", "important"],
|
|
"ignore_unavailable": false,
|
|
"include_global_state": false
|
|
},
|
|
"retention": {
|
|
"expire_after": "30d",
|
|
"min_count": 5,
|
|
"max_count": 50
|
|
}
|
|
},
|
|
"stats": {
|
|
"policy": "daily-snapshots",
|
|
"snapshots_taken": 0,
|
|
"snapshots_failed": 0,
|
|
"snapshots_deleted": 0,
|
|
"snapshot_deletion_failures": 0
|
|
},
|
|
"next_execution": "2099-05-07T01:30:00.000Z", <3>
|
|
"next_execution_millis": 4081843800000
|
|
}
|
|
}
|
|
----
|
|
// TESTRESPONSE[s/"version": 1/"version": $body.daily-snapshots.version/]
|
|
// TESTRESPONSE[s/"modified_date": "2099-05-06T01:30:00.000Z"/"modified_date": $body.daily-snapshots.modified_date/]
|
|
// TESTRESPONSE[s/"modified_date_millis": 4081757400000/"modified_date_millis": $body.daily-snapshots.modified_date_millis/]
|
|
// TESTRESPONSE[s/"next_execution": "2099-05-07T01:30:00.000Z"/"next_execution": $body.daily-snapshots.next_execution/]
|
|
// TESTRESPONSE[s/"next_execution_millis": 4081843800000/"next_execution_millis": $body.daily-snapshots.next_execution_millis/]
|
|
<1> The version of the snapshot policy, only the latest version is stored and incremented when the policy is updated
|
|
<2> The last time this policy was modified.
|
|
<3> The next time this policy will be executed.
|
|
|
|
|
|
[[slm-api-get-all-ex]]
|
|
===== Get all policies
|
|
|
|
[source,console]
|
|
----
|
|
GET _slm/policy
|
|
----
|
|
// TEST[continued]
|