【问题标题】:elasticsearch: create index tamplate from existing indexelasticsearch:从现有索引创建索引模板
【发布时间】:2021-05-06 14:47:50
【问题描述】:

我在 Elasticsearch 中创建了一个索引。现在我需要为这个索引创建一个索引模板。我没有在文档中找到与此主题相关的任何内容。我的问题是:是否可以根据 Elasticsearch 中的现有索引创建索引模板?坦克

【问题讨论】:

    标签: templates elasticsearch indexing


    【解决方案1】:

    是的,您需要分两步完成:

    首先,使用检索索引映射和设置

    GET my-index
    

    然后,您可以使用从第一步中获得的结果,通过运行创建index template

    PUT _index_template/my_index_template
    {
      "index_patterns": ["my-index-*"],
      "template": {
         "mappings": {
           ...                <--- add the mappings you got from the first call
         },
         "settings": {
           ...                <--- add the settings you got from the first call
         },
         "aliases": {
           ...                <--- add the aliases you got from the first call
         }
      },
      "priority": 200,
      "composed_of": [],
      "version": 1
    }
    

    【讨论】:

    • 酷!还需要什么吗?如果没有,您可以接受答案,谢谢;-)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-09
    • 1970-01-01
    相关资源
    最近更新 更多