elasticsearch/docs/reference/indices/delete-component-template.asciidoc
Martijn van Groningen 715eb90fea
Support specifying multiple templates names in delete component template api (#70314)
Add support to delete component templates api to specify multiple template
names separated by a comma.

Change the cleanup template logic for rest tests to remove all component templates via a single delete component template request. This to optimize the cleanup logic. After each rest test we delete all templates. So deleting templates this via a single api call (and thus single cluster state update) saves a lot of time considering the number of rest tests.

Older versions don't support component / composable index templates
and/or data streams. Yet the test base class tries to remove objects
after each test, which adds a significant number of lines to the
log files (which slows the tests down). The ESRestTestCase will
now check whether all nodes have a specific version and then decide
whether data streams and component / composable index templates will
be deleted.

Also ensured that the logstash-index-template and security-index-template
aren't deleted between tests, these templates are builtin templates that
ES will install if missing. So if tests remove these templates between tests
then ES will add these template back almost immediately. These causes
many log lines and a lot of cluster state updates, which slow tests down.

Relates to #69973

Co-authored-by: Lee Hinman <dakrone@users.noreply.github.com>
2021-03-15 13:08:49 +01:00

61 lines
1.8 KiB
Text

[[indices-delete-component-template]]
=== Delete component template API
++++
<titleabbrev>Delete component template</titleabbrev>
++++
Deletes an existing component template.
////
[source,console]
--------------------------------------------------
PUT _component_template/template_1
{
"template": {
"settings": {
"index.number_of_replicas": 0
}
}
}
--------------------------------------------------
// TESTSETUP
////
[source,console]
--------------------------------------------------
DELETE _component_template/template_1
--------------------------------------------------
The provided <component-template> may contain multiple template names separated by a comma.
If multiple template names are specified then there is no wildcard support and the
provided names should match completely with existing component templates.
[[delete-component-template-api-request]]
==== {api-request-title}
`DELETE /_component_template/<component-template>`
[[delete-component-template-api-prereqs]]
==== {api-prereq-title}
* If the {es} {security-features} are enabled, you must have the
`manage_index_templates` or `manage` <<privileges-list-cluster,cluster
privilege>> to use this API.
[[delete-component-template-api-desc]]
==== {api-description-title}
Use the delete component template API to delete one or more component templates
Component templates are building blocks for constructing <<index-templates,index templates>>
that specify index mappings, settings, and aliases.
[[delete-component-template-api-path-params]]
==== {api-path-parms-title}
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=component-template]
[[delete-component-template-api-query-params]]
==== {api-query-parms-title}
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=timeoutparms]