File tree 1 file changed +45
-0
lines changed
1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Step 1 Create policy
2
+ ``` bash
3
+ PUT _ilm/policy/delete_1d
4
+ {
5
+ " policy" : {
6
+ " phases" : {
7
+ " delete" : {
8
+ " min_age" : " 1d" ,
9
+ " actions" : {
10
+ " delete" : {}
11
+ }
12
+ }
13
+ }
14
+ }
15
+ }
16
+ ```
17
+ # Step 2 Create template
18
+ ` Template index ` sẽ được áp dụng để định dạng chỉ ` index ` tiếp theo các quy tắc được xác định trong mẫu.
19
+ ``` bash
20
+ PUT _template/my_test_template
21
+ {
22
+ " index_patterns" : [" nginx-*" ],
23
+ " settings" : {
24
+ " number_of_shards" : 1,
25
+ " index.lifecycle.name" : " delete_1d"
26
+ }
27
+ }
28
+ ```
29
+ # Step 3 Set policy
30
+ Set policy cho index cũ
31
+ ``` bash
32
+ PUT nginx-* /_settings
33
+ {
34
+ " index" : {
35
+ " lifecycle" : {
36
+ " name" : " delete_1d"
37
+ }
38
+ }
39
+ }
40
+ ```
41
+ Check age index dùng api GET
42
+ ``` bash
43
+ GET nginx-* /_ilm/explain
44
+ ```
45
+ Sau khi vào trạng thái Delete từ 0 - 30p index sẽ được xóa
You can’t perform that action at this time.
0 commit comments