Elasticsearch ILM

ILMIndex Lifecycle Management 索引生命周期策略

给索引添加别名

在 Kibana 的 Dev Tools 的控制台中输入如下内容,点击输入框右上角的开始按钮(▶)。

POST /_aliases
{
    "actions" : [
        { "add" : { "index" : "xyb-zy-log-2020.11.13", "alias" : "xyb-zy-log" } }
    ]
}
  

使用原子级操作更换索引别名

POST /_aliases
{
    "actions" : [
        { "remove" : { "index" : "test1", "alias" : "alias1" } },
        { "add" : { "index" : "test1", "alias" : "alias2" } }
    ]
}
  

index.lifecycle.rollover_alias [my-alias] does not point to index [my-index]

illegal_argument_exception: index.lifecycle.rollover_alias [test-xyb-zy-log] does not point to index [test-xyb-zy-log-2020.11.14]

POST /_aliases
{
    "actions" : [
        { "add" : { "index" : "test-xyb-zy-log-2020.11.14", "alias" : "test-xyb-zy-log" } }
    ]
}
  

source alias [my-alias] does not point to a write index

illegal_argument_exception: source alias [xyb-zy-log] does not point to a write index

别名应该指定一个写索引:

PUT test-xyb-zy-log-2020.11.16
{
  "aliases": {
    "test-xyb-zy-log": { "is_write_index": true } 
  }
}
  

Rollover index API
索引别名和零停机