解决报错

This commit is contained in:
zhangkun9038@dingtalk.com 2025-03-28 00:27:43 +08:00
parent d573e8d967
commit e4f05bb543
2 changed files with 13 additions and 7 deletions

View File

@ -213,6 +213,9 @@ func ensureILMPolicy(client *http.Client, esConfig cfg.ElasticsearchConfig, poli
},
"delete": map[string]interface{}{
"min_age": fmt.Sprintf("%dd", retentionDays),
"actions": map[string]interface{}{
"delete": map[string]interface{}{}, // 添加 delete 动作
},
},
},
},
@ -250,6 +253,9 @@ func ensureILMPolicy(client *http.Client, esConfig cfg.ElasticsearchConfig, poli
},
"delete": map[string]interface{}{
"min_age": fmt.Sprintf("%dd", retentionDays),
"actions": map[string]interface{}{
"delete": map[string]interface{}{}, // 添加 delete 动作
},
},
},
},

View File

@ -527,21 +527,21 @@ func parsePeriod(period string) (time.Duration, error) {
return 15 * time.Minute, nil
case "30m":
return 30 * time.Minute, nil
case "1h":
case "1H":
return time.Hour, nil
case "2h":
case "2H":
return 2 * time.Hour, nil
case "4h":
case "4H":
return 4 * time.Hour, nil
case "6h":
case "6H":
return 6 * time.Hour, nil
case "12h":
case "12H":
return 12 * time.Hour, nil
case "1D", "1d":
return 24 * time.Hour, nil
case "2d":
case "2D":
return 48 * time.Hour, nil
case "5d":
case "5D":
return 120 * time.Hour, nil
case "1W":
return 168 * time.Hour, nil