【问题标题】:Elasticsearch - how to bulk insert index + add index to alias?Elasticsearch - 如何批量插入索引+将索引添加到别名?
【发布时间】:2017-06-02 18:23:43
【问题描述】:

我有一个创建索引的脚本,这些索引是使用 _bulk API 定期生成的。例如,它将创建以下内容:

/foo_2017-06-01/bar/abcd
/foo_2017-05-31/bar/efgh
....

但我想要一个别名来索引所有这些索引 - 以及更新的索引。例如我想要:

/foo --> [/foo_2017-06-01, /foo_2017-05-31, ...]

这可能吗?或者我可以做些什么来实现同样的目标?

【问题讨论】:

    标签: elasticsearch alias


    【解决方案1】:

    您可以使用模板来执行此操作: https://www.elastic.co/guide/en/elasticsearch/reference/5.4/indices-templates.html

    模板允许您自动将设置应用于新创建的索引。例如,以下模板将应用于所有带有 'foo_' 前缀的索引,并将其添加到 foo 别名中。

    PUT _template/template_1
    {
        "template" : "foo_*",
        "settings" : {
            "number_of_shards" : 1
        },
        "aliases" : {,
            "foo" : {} 
        }
    }
    

    【讨论】:

      猜你喜欢
      • 2016-03-11
      • 2016-04-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-07
      • 1970-01-01
      • 2011-12-30
      相关资源
      最近更新 更多