一、index Template
这种模板也称之为静态模板,只能控制一些已知名字的字段,提前准备好索引的配置,待使用该类型的索引时,生成与索引模板配置相同的索引提供给用户使用。
Index templates allow you to define templates that will automatically be applied when new indices are created. The templates include both settings and mappings and a simple pattern template that controls whether the template should be applied to the new index.
索引模板允许您定义创建新索引时自动应用的模板。模板包括设置和映射以及一个简单的模式模板,用来控制模板是否应该应用到新的索引中。
Templates are only applied at index creation time. Changing a template will have no impact on existing indices. When using the create index API, the settings/mappings defined as part of the create index call will take precedence over any matching settings/mappings defined in the template.
模板仅在创建索引时应用。更改模板不会对现有索引产生影响。使用 create index API 时,作为创建索引调用一部分定义的设置/映射将优先于模板中定义的任何匹配设置/映射。
二、索引使用场景
由于一个索引已经满足不了业务场景,