elasticsearch 定期更新索引模板,如通过terraform更新logstash

hjqgdpho  于 2023-01-12  发布在  ElasticSearch
关注(0)|答案(1)|浏览(147)

例如,在logstash中,我们有下一个选项,用于定期更新索引模板(在输出插件中)

elasticsearch {
            hosts => ["${elasticsearch}:${elasticsearch_port}"]
            index => "v2-documents"
            template => "/local/template/template.json"
            template_name => "document"
            manage_template => true
            template_overwrite => true
        }

按选项template_overwrite按模板名称
假设我想添加一个没有logstash的模板,但是使用了这样的地形

resource "elasticstack_elasticsearch_index_template" "document" {
  name     = "document"

  index_patterns = ["v2-documents"]

  template {
    settings = jsonencode({
      number_of_shards = 1
      index = {
        default_pipeline = "routing-ingest-pipeline"
      }
    })
    alias {
      name = "documents-"
    }
    mappings = file("/local/template/template.json")
  }
  version = 1
}

在设置部分我做了一些更改(例如,添加摄取管道),但当我替换logstash并通过terraform管理此模板时,更改尚未应用(未添加摄取管道)。我知道在logstash中它是通过选项template_overwrite管理的,如何通过terraform实现相同的功能?

mbjcgjjk

mbjcgjjk1#

在街区里
索引模式= [“v2-文档”]
请改用通配符,如index_patterns = ["v2-documents-*"]。该模板将应用于以**v2-documents* 开头的所有索引,例如:v2-文档-001,v2-文档-样本... x1c 0d1x地形:ElasticSearch索引模板

相关问题