You're viewing version 2.13 of the OpenSearch documentation. This version is no longer maintained. For the latest version, see the current documentation. For information about OpenSearch version maintenance, see Release Schedule and Maintenance Policy.
Component templates
Introduced 2.7
Component templates allow you to create a single index pattern that matches multiple indexes. This pattern can include wildcards or regular expressions, enabling you to apply the same setting or mapping to multiple indexes simultaneously.
Using them with index templates can provide a powerful tool for managing large volumes of data. You can create an index template that defines the basic structure and settings of your indexes and then use the component templates to apply the settings to all indexes that match a specific pattern or set of criteria.
You can create component templates using the Index Management UI. The UI maximizes ease of use for common indexing and data stream administrative operations such as create, read, update, delete (CRUD) and mapping indexes; CRUD and mapping aliases; reindexing; and open/close, shrink, and split indexes, along with the monitoring of actions and logging of audit records.
The following GIF demonstrates creating a component template.
Prerequisites
This tutorial is intended for admin users who manage OpenSearch clusters and are familiar with index management in OpenSearch Dashboards.
Key terms
It’s helpful to understand the following terms before starting this tutorial:
- Component template refers to a reusable building block with settings, mappings, and aliases that can be attached to an index template.
- Index template refers to a predefined structure used to organize and store data in a database or search index.
Creating component templates using the Index Management UI
You can use predefined OpenSearch Dashboards component templates or customize your own, either by creating original templates or by modifying existing templates. Predefined component templates include preconfigured charts, tables, and graphs and are a good starting point for users who are new to OpenSearch Dashboards. Alternatively, customized template components provide you with options for tailoring reports and visualizations that meet your specific requirements and preferences.
To create template components using the UI, follow these steps:
- On the OpenSearch Dashboards main page, select Index Management in the navigation menu.
- In the Index Management window, select Templates > Component templates.
- Select Create and then define the component template settings.
-
To configure aliases, settings, and mappings, toggle Use configuration, as shown in the following image.
- Enter details in the aliases, settings, and mappings fields.
- Select Create component template.
When you create component templates, those templates apply only to new index templates that you create and not to existing index templates.
Associating component templates with index templates
To associate a component template with an index template, follow these steps:
- In the Index Management navigation menu, select Templates.
- In the Templates window, select Create template.
- Select Component template as the method for defining your template.
-
In the Component template pane, select Associate component template, as shown in the following image.
- In the Associate component template pop-up window, select the component templates that you want to associate with your index template.
- Select Associate.
- Select Preview template to view the template settings.
- Select Create template.