繁体   English   中英

elasticsearch:从现有索引创建索引模板

[英]elasticsearch: create index tamplate from existing index

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

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

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

GET my-index

然后,您可以使用从第一步中获得的结果,通过运行来创建索引模板

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
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM