Elasticsearch
Index Templates
The index templates are elements where it is possible to specify configurations that will be applied to indices when created. For more information on how it works in Elasticsearch, see the Elasticsearch manual.
The LumisXP creates index templates in Elasticsearch that serve to apply the default configurations used by it in the indices it creates. To customize or include configurations to be applied to the indices when created, one must use the index templates functionality. Below is explained the elements that LumisXP creates and the main ways to include custom configurations in them.
The LumisXP will create the component template:
Name Pattern | Example | Description |
---|---|---|
<prefix>-custom | lumisportal-custom | If it does not exist, it is created empty. It can be created or updated with custom configurations. It is included in the default template for all languages. |
For each language (in its initial installation, LumisXP comes with the languages pt_BR
and en_US
)
and for neutral language (represented by null
), the LumisXP will create the following
component templates:
Name Pattern | Example | Description |
---|---|---|
<prefix>-<language>-default | lumisportal-pt_br-default | Contains the default configurations of LumisXP for indices in this language. Should not be altered. |
<prefix>-<language>-custom | lumisportal-pt_br-custom | If it does not exist, it is created empty. It can be created or updated with custom configurations. It is included in the default template of the corresponding language. Your configuration takes precedence over any configuration that is also present in the aforementioned global custom component (e.g., lumisportal-custom). |
For each language and for neutral language, LumisXP will create the following index template:
Name Pattern | Example | Description |
---|---|---|
<prefix>-<language> | lumisportal-pt_br | Template with zero priority, which is composed of the three components presented above. Should not be altered. |
There are two ways to include configurations in the template that will be used to configure the indices created
by LumisXP. The simplest is registering the -custom
component templates mentioned above.
The more complex but flexible way is registering other index templates that will be used instead of the ones LumisXP creates.
Customizing Custom Component Template
Just use the API to create or update component template
to create or update the *-custom
component templates mentioned above with the desired configurations.
In the case of a new installation of LumisXP, one can create these components before starting LumisXP for the first time, so that they can be applied from the first indices it creates. If an index from LumisXP already exists, they will need to be adjusted manually, as the template is only applied at the moment of index creation.
For example, if it is desired that the template configures new indices of LumisXP to not have replicas,
assuming default configurations, one could create the component template named lumisportal-custom
with the following definition:
{
"template" : {
"settings" : {
"number_of_replicas": 0
}
}
}
If a configuration that varies with the language is desired, one could use the specific language component templates,
such as lumisportal-pt_br-custom
or lumisportal-en_us-custom
.
Customizing an Index Template
In this other method, one creates other index templates that will be used instead of the index templates created by
LumisXP. For this, the created index templates must have priority above zero and have the
appropriate pattern to be used in the indices created by LumisXP. These index templates can also
take advantage of the component template *-default
, which has the necessary default configurations for the indices of LumisXP, but for this LumisXP will need to have started beforehand to have
created the component. In this case, it will probably have created indices that will need to be adjusted
manually, since the configurations of the templates are only applied at the moment of index creation.
To create the customized index template, one can use the
API to create or update index template.
For example, using this approach to change the template used for indices of the language pt_br
,
in an installation of LumisXP with the default configurations, for a custom index template that uses
the component templates created by LumisXP and includes configuration to have no replicas,
one could create a new index template with the following definition:
{
"index_patterns" : [
"lumisportal-pt_br-*"
],
"priority" : 1,
"composed_of": ["lumisportal-pt_br-default","lumisportal-custom","lumisportal-pt_br-custom"],
"template" : {
"settings" : {
"number_of_replicas": 0
}
}
}
```