【发布时间】:2022-12-03 16:20:05
【问题描述】:
我正在尝试从 Elastic Golang 客户端 olivere 创建索引生命周期管理 (ILM) 策略,以删除超过 3 个月的索引(使用“每天索引”模式)。是这样的:
{
"policy": {
"phases": {
"delete": {
"min_age": "90d",
"actions": {
"delete": {}
}
}
}
}
}
我可以在 lib 的源代码中看到它的结构:XPackIlmPutLifecycleService 具有以下字段:
type XPackIlmPutLifecycleService struct {
client *Client
pretty *bool // pretty format the returned JSON response
human *bool // return human readable values for statistics
errorTrace *bool // include the stack trace of returned errors
filterPath []string // list of filters used to reduce the response
headers http.Header // custom request-level HTTP headers
policy string
timeout string
masterTimeout string
flatSettings *bool
bodyJson interface{}
bodyString string
}
这是文档link。但是我有点困惑如何使用它来创建策略来完成工作,因为它似乎缺少一些字段(例如 min_age 来设置索引的 TTL)。通过此客户端创建 ILM 策略的正确方法是什么。
【问题讨论】:
标签: go elasticsearch go-olivere