amazon-web-services - ElasticSearch,AWS:通过 ILM 删除超过 4 天的索引数据给出错误
问题描述
我正在尝试在基于 AWS 的 ElasticSearch(7.9) 中添加 ILM 策略以删除超过 4 天的数据,但出现以下错误:
错误日志:
[illegal_argument_exception] State name is null
政策 :
{
"policy": {
"description": "Delete older than 4 days",
"default_state": "hot",
"states": [
{
"transitions": [
{
"state_name": "delete",
"conditions": {
"min_index_age": "4d"
}
}
]
}
]
}
}
我究竟做错了什么?
解决方案
每个“州”都必须有一个字段“名称”。所以在你的情况下,这看起来像这样:
{
"policy": {
"description": "Delete older than 4 days",
"default_state": "hot",
"states": [
{
"name": "hot",
"actions": [],
"transitions": [
{
"state_name": "delete",
"conditions": {
"min_index_age": "4d"
}
}
]
},
{
"name": "delete",
"actions": [
{
"delete":{}
}
],
"transitions": []
}
]
}
}
如您所见,我将此状态命名为“热”,因为它是您的默认状态,所以我想此默认状态必须在您的策略中进行描述。并且为了您的信息,这种转换没有产生任何效果(操作字段为空)。所以我写了第二个状态调用“detele”,它当前将删除索引。