[[reference-cluster-put_component_template]]

////////
===========================================================================================================================
||                                                                                                                       ||
||                                                                                                                       ||
||                                                                                                                       ||
||        ██████╗ ███████╗ █████╗ ██████╗ ███╗   ███╗███████╗                                                            ||
||        ██╔══██╗██╔════╝██╔══██╗██╔══██╗████╗ ████║██╔════╝                                                            ||
||        ██████╔╝█████╗  ███████║██║  ██║██╔████╔██║█████╗                                                              ||
||        ██╔══██╗██╔══╝  ██╔══██║██║  ██║██║╚██╔╝██║██╔══╝                                                              ||
||        ██║  ██║███████╗██║  ██║██████╔╝██║ ╚═╝ ██║███████╗                                                            ||
||        ╚═╝  ╚═╝╚══════╝╚═╝  ╚═╝╚═════╝ ╚═╝     ╚═╝╚══════╝                                                            ||
||                                                                                                                       ||
||                                                                                                                       ||
||    This file is autogenerated, DO NOT send pull requests that changes this file directly.                             ||
||    You should update the script that does the generation, which can be found in:                                      ||
||    https://github.com/elastic/elastic-client-generator-js                                                             ||
||                                                                                                                       ||
||    You can run the script with the following command:                                                                 ||
||       npm run elasticsearch -- --version <version>                                                                    ||
||                                                                                                                       ||
||                                                                                                                       ||
||                                                                                                                       ||
===========================================================================================================================
////////

[discrete]
=== client.cluster.putComponentTemplate

Create or update a component template. Creates or updates a component template. Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases. An index template can be composed of multiple component templates. To use a component template, specify it in an index template’s `composed_of` list. Component templates are only applied to new data streams and indices as part of a matching index template. Settings and mappings specified directly in the index template or the create index request override any settings or mappings specified in a component template. Component templates are only used during index creation. For data streams, this includes data stream creation and the creation of a stream’s backing indices. Changes to component templates do not affect existing indices, including a stream’s backing indices. You can use C-style `/* *\/` block comments in component templates. You can include comments anywhere in the request body except before the opening curly bracket.

{ref}/indices-component-template.html[{es} documentation]

[discrete]
==== Function signature

[source,ts]
----
(ClusterPutComponentTemplateRequest, options?): Promise<ClusterPutComponentTemplateResponse>
----

[discrete]
===== `ClusterPutComponentTemplateRequest`

[source,ts]
----
interface ClusterPutComponentTemplateRequest extends <<shared-type-request-base, RequestBase>> {
  name: <<shared-type-name, Name>>
  create?: boolean
  master_timeout?: <<shared-type-duration, Duration>>
  template: IndicesIndexState
  version?: <<shared-type-version-number, VersionNumber>>
  _meta?: <<shared-type-metadata, Metadata>>
  deprecated?: boolean
}
----

[discrete]
===== `ClusterPutComponentTemplateResponse`

[source,ts]
----
type ClusterPutComponentTemplateResponse = <<shared-type-acknowledged-response-base, AcknowledgedResponseBase>>
----

