Skip to content

Commit 19e6ee4

Browse files
committed
Add SLM API examples
1 parent abc0d99 commit 19e6ee4

File tree

4 files changed

+33
-2
lines changed

4 files changed

+33
-2
lines changed

output/schema/schema.json

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

specification/slm/put_lifecycle/PutSnapshotLifecycleRequest.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import { Duration } from '@_types/Time'
3333
* @availability serverless stability=stable visibility=private
3434
* @cluster_privileges manage_slm
3535
* @index_privileges manage
36+
* @doc_id slm-api-put-policy
3637
*/
3738
export interface Request extends RequestBase {
3839
path_parts: {
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
summary: Create a policy
2+
# method_request: PUT /_slm/policy/daily-snapshots
3+
description: >
4+
Run `PUT /_slm/policy/daily-snapshots` to create a lifecycle policy.
5+
The `schedule` is when the snapshot should be taken, in this case, 1:30am daily.
6+
The `retention` details specify to: keep snapshots for 30 days; always keep at least 5 successful snapshots, even if they're more than 30 days old; keep no more than 50 successful snapshots, even if they're less than 30 days old.
7+
# type: request
8+
value:
9+
"{\n \"schedule\": \"0 30 1 * * ?\",\n \"name\": \"<daily-snap-{now/d}>\"\
10+
,\n \"repository\": \"my_repository\",\n \"config\": {\n \"indices\": [\"data-*\"\
11+
, \"important\"],\n \"ignore_unavailable\": false,\n \"include_global_state\"\
12+
: false\n },\n \"retention\": {\n \"expire_after\": \"30d\",\n \"min_count\"\
13+
: 5,\n \"max_count\": 50\n }\n}"
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
summary: Create a policy with intevals
2+
# method_request: PUT /_slm/policy/hourly-snapshots
3+
description: >
4+
Run `PUT /_slm/policy/hourly-snapshots` to create a lifecycle policy that uses interval scheduling.
5+
It creates a snapshot once every hour.
6+
The first snapshot will be created one hour after the policy is modified, with subsequent snapshots being created every hour afterward.
7+
# type: request
8+
value: |-
9+
{
10+
"schedule": "1h",
11+
"name": "<hourly-snap-{now/d}>",
12+
"repository": "my_repository",
13+
"config": {
14+
"indices": ["data-*", "important"]
15+
}
16+
}

0 commit comments

Comments
 (0)