且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ElasticSearch-滚动索引的别名自动更新

更新时间:2023-09-08 09:07:34

是的,您可以使用模板。

Yep, you can use a template.

PUT /_template/my_elmah_template
{
  "template" : "elmah_*",
  "alias" : {
    "elmah_all" : { }
  }
}

空对象是必不可少的,因为JSON期望 field:值

The empty object is a necessary evil because JSON expects field : value.

只要匹配的索引(基于模板参数)创建,然后它将自动对其应用模板。在这种情况下,模板唯一要做的就是为其添加别名。

Whenever a matching index (based on the template parameter) is created, then it will automatically apply the template to it. In this case, the only thing that the template is doing is to add an alias to it.

您还可以使用模板来设置设置和映射