Class PutIndexTemplateRequest
- All Implemented Interfaces:
JsonpSerializable
Elasticsearch applies templates to new indices based on an wildcard pattern that matches the index name. Index templates are applied during data stream or index creation. For data streams, these settings and mappings are applied when the stream's backing indices are created. Settings and mappings specified in a create index API request override any settings or mappings specified in an index template. Changes to index templates do not affect existing indices, including the existing backing indices of a data stream.
You can use C-style /* *\/
block comments in index templates.
You can include comments anywhere in the request body, except before the
opening curly bracket.
Multiple matching templates
If multiple index templates match the name of a new index or data stream, the template with the highest priority is used.
Multiple templates with overlapping index patterns at the same priority are not allowed and an error will be thrown when attempting to create a template matching an existing index template at identical priorities.
Composing aliases, mappings, and settings
When multiple component templates are specified in the
composed_of
field for an index template, they are merged in the
order specified, meaning that later component templates override earlier
component templates. Any mappings, settings, or aliases from the parent index
template are merged in next. Finally, any configuration on the index request
itself is merged. Mapping definitions are merged recursively, which means
that later mapping components can introduce new field mappings and update the
mapping configuration. If a field mapping is already contained in an earlier
component, its definition will be completely overwritten by the later one.
This recursive merging strategy applies not only to field mappings, but also
root options like dynamic_templates
and meta
. If an
earlier component contains a dynamic_templates
block, then by
default new dynamic_templates
entries are appended onto the end.
If an entry already exists with the same key, then it is overwritten by the
new definition.
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class co.elastic.clients.elasticsearch._types.RequestBase
RequestBase.AbstractBuilder<BuilderT extends RequestBase.AbstractBuilder<BuilderT>>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final JsonpDeserializer<PutIndexTemplateRequest>
Json deserializer forPutIndexTemplateRequest
static final Endpoint<PutIndexTemplateRequest,
PutIndexTemplateResponse, ErrorResponse> Endpoint "indices.put_index_template
". -
Method Summary
Modifier and TypeMethodDescriptionfinal Boolean
This setting overrides the value of theaction.auto_create_index
cluster setting.final String
cause()
User defined reason for creating/updating the index templateAn ordered list of component template names.final Boolean
create()
Iftrue
, this request cannot replace or update existing index templates.final DataStreamVisibility
If this object is included, the template is used to create data streams and their backing indices.final Boolean
Marks this index template as deprecated.The configuration option ignore_missing_component_templates can be used when an index template references a component template that might not existName of the index template to create.final Time
Period to wait for a connection to the master node.meta()
Optional user metadata about the index template.final String
name()
Required - Index or template namestatic PutIndexTemplateRequest
final Long
priority()
Priority to determine index template precedence when a new data stream or index is created.void
serialize
(jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper) Serialize this object to JSON.protected void
serializeInternal
(jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper) protected static void
final IndexTemplateMapping
template()
Template to be applied.final Long
version()
Version number used to manage index templates externally.Methods inherited from class co.elastic.clients.elasticsearch._types.RequestBase
toString
-
Field Details
-
_DESERIALIZER
Json deserializer forPutIndexTemplateRequest
-
_ENDPOINT
public static final Endpoint<PutIndexTemplateRequest,PutIndexTemplateResponse, _ENDPOINTErrorResponse> Endpoint "indices.put_index_template
".
-
-
Method Details
-
of
public static PutIndexTemplateRequest of(Function<PutIndexTemplateRequest.Builder, ObjectBuilder<PutIndexTemplateRequest>> fn) -
meta
Optional user metadata about the index template. It may have any contents. It is not automatically generated or used by Elasticsearch. This user-defined object is stored in the cluster state, so keeping it short is preferable To unset the metadata, replace the template without specifying it.API name:
_meta
-
allowAutoCreate
This setting overrides the value of theaction.auto_create_index
cluster setting. If set totrue
in a template, then indices can be automatically created using that template even if auto-creation of indices is disabled viaactions.auto_create_index
. If set tofalse
, then indices or data streams matching the template must always be explicitly created, and may never be automatically created.API name:
allow_auto_create
-
cause
User defined reason for creating/updating the index templateAPI name:
cause
-
composedOf
An ordered list of component template names. Component templates are merged in the order specified, meaning that the last component template specified has the highest precedence.API name:
composed_of
-
create
Iftrue
, this request cannot replace or update existing index templates.API name:
create
-
dataStream
If this object is included, the template is used to create data streams and their backing indices. Supports an empty object. Data streams require a matching index template with adata_stream
object.API name:
data_stream
-
deprecated
Marks this index template as deprecated. When creating or updating a non-deprecated index template that uses deprecated components, Elasticsearch will emit a deprecation warning.API name:
deprecated
-
ignoreMissingComponentTemplates
The configuration option ignore_missing_component_templates can be used when an index template references a component template that might not existAPI name:
ignore_missing_component_templates
-
indexPatterns
Name of the index template to create.API name:
index_patterns
-
masterTimeout
Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.API name:
master_timeout
-
name
Required - Index or template nameAPI name:
name
-
priority
Priority to determine index template precedence when a new data stream or index is created. The index template with the highest priority is chosen. If no priority is specified the template is treated as though it is of priority 0 (lowest priority). This number is not automatically generated by Elasticsearch.API name:
priority
-
template
Template to be applied. It may optionally include analiases
,mappings
, orsettings
configuration.API name:
template
-
version
Version number used to manage index templates externally. This number is not automatically generated by Elasticsearch. External systems can use these version numbers to simplify template management. To unset a version, replace the template without specifying one.API name:
version
-
serialize
Serialize this object to JSON.- Specified by:
serialize
in interfaceJsonpSerializable
-
serializeInternal
-
setupPutIndexTemplateRequestDeserializer
protected static void setupPutIndexTemplateRequestDeserializer(ObjectDeserializer<PutIndexTemplateRequest.Builder> op)
-