Create or update a component template

PUT /_component_template/{name}

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.

Path parameters

  • name string Required

    Name of the component template to create. Elasticsearch includes the following built-in component templates: logs-mappings; logs-settings; metrics-mappings; metrics-settings;synthetics-mapping; synthetics-settings. Elastic Agent uses these templates to configure backing indices for its data streams. If you use Elastic Agent and want to overwrite one of these templates, set the version for your replacement template higher than the current version. If you don’t use Elastic Agent and want to disable all built-in component and index templates, set stack.templates.enabled to false using the cluster update settings API.

Query parameters

  • create boolean

    If true, this request cannot replace or update existing component templates.

  • 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.

application/json

Body Required

  • template object Required
    Hide template attributes Show template attributes object
    • aliases object
      Hide aliases attributes Show aliases attributes object
      • filter object
        Hide filter attributes Show filter attributes object
        • bool object
          Hide bool attributes Show bool attributes object
        • boosting object
          Hide boosting attributes Show boosting attributes object
          • boost number

            Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.

          • _name string
          • negative_boost number Required

            Floating point number between 0 and 1.0 used to decrease the relevance scores of documents matching the negative query.

          • negative object Required
          • positive object Required
        • common object Deprecated
        • Hide combined_fields attributes Show combined_fields attributes object
          • boost number

            Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.

          • _name string
          • fields array[string] Required

            Path to field or array of paths. Some API's support wildcards in the path to select multiple fields.

          • query string Required

            Text to search for in the provided fields. The combined_fields query analyzes the provided text before performing a search.

          • If true, match phrase queries are automatically created for multi-term synonyms.

          • operator string

            Values are or or and.

          • Values are none or all.

        • Hide constant_score attributes Show constant_score attributes object
          • boost number

            Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.

          • _name string
          • filter object Required
        • dis_max object
          Hide dis_max attributes Show dis_max attributes object
          • boost number

            Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.

          • _name string
          • queries array[object] Required

            One or more query clauses. Returned documents must match one or more of these queries. If a document matches multiple queries, Elasticsearch uses the highest relevance score.

          • Floating point number between 0 and 1.0 used to increase the relevance scores of documents matching multiple query clauses.

        • exists object
          Hide exists attributes Show exists attributes object
          • boost number

            Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.

          • _name string
          • field string Required

            Path to field or array of paths. Some API's support wildcards in the path to select multiple fields.

        • Hide function_score attributes Show function_score attributes object
          • boost number

            Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.

          • _name string
          • Values are multiply, replace, sum, avg, max, or min.

          • functions array[object]

            One or more functions that compute a new score for each document returned by the query.

          • Restricts the new score to not exceed the provided limit.

          • Excludes documents that do not meet the provided score threshold.

          • query object
          • Values are multiply, sum, avg, first, max, or min.

        • fuzzy object

          Returns documents that contain terms similar to the search term, as measured by a Levenshtein edit distance.

        • Hide geo_bounding_box attributes Show geo_bounding_box attributes object
          • boost number

            Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.

          • _name string
          • type string

            Values are memory or indexed.

          • Values are coerce, ignore_malformed, or strict.

          • Set to true to ignore an unmapped field and not match any documents for this query. Set to false to throw an exception if the field is not mapped.

        • Hide geo_distance attributes Show geo_distance attributes object
          • boost number

            Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.

          • _name string
          • distance string Required
          • Values are arc or plane.

          • Values are coerce, ignore_malformed, or strict.

          • Set to true to ignore an unmapped field and not match any documents for this query. Set to false to throw an exception if the field is not mapped.

        • Hide geo_polygon attributes Show geo_polygon attributes object
          • boost number

            Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.

          • _name string
          • Values are coerce, ignore_malformed, or strict.

        • Hide geo_shape attributes Show geo_shape attributes object
          • boost number

            Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.

          • _name string
          • Set to true to ignore an unmapped field and not match any documents for this query. Set to false to throw an exception if the field is not mapped.

        • Hide has_child attributes Show has_child attributes object
          • boost number

            Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.

          • _name string
          • Indicates whether to ignore an unmapped type and not return any documents instead of an error.

          • Maximum number of child documents that match the query allowed for a returned parent document. If the parent document exceeds this limit, it is excluded from the search results.

          • Minimum number of child documents that match the query required to match the query for a returned parent document. If the parent document does not meet this limit, it is excluded from the search results.

          • query object Required
          • Values are none, avg, sum, max, or min.

          • type string Required
        • Hide has_parent attributes Show has_parent attributes object
          • boost number

            Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.

          • _name string
          • Indicates whether to ignore an unmapped parent_type and not return any documents instead of an error. You can use this parameter to query multiple indices that may not contain the parent_type.

          • parent_type string Required
          • query object Required
          • score boolean

            Indicates whether the relevance score of a matching parent document is aggregated into its child documents.

        • ids object
          Hide ids attributes Show ids attributes object
          • boost number

            Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.

          • _name string
        • Returns documents based on the order and proximity of matching terms.

        • knn object
          Hide knn attributes Show knn attributes object
          • boost number

            Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.

          • _name string
          • field string Required

            Path to field or array of paths. Some API's support wildcards in the path to select multiple fields.

          • query_vector array[number]
          • The number of nearest neighbor candidates to consider per shard

          • k number

            The final number of nearest neighbors to return as top hits

          • The minimum similarity for a vector to be considered a match

        • match object

          Returns documents that match a provided text, number, date or boolean value. The provided text is analyzed before matching.

        • Hide match_all attributes Show match_all attributes object
          • boost number

            Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.

          • _name string
        • Analyzes its input and constructs a bool query from the terms. Each term except the last is used in a term query. The last term is used in a prefix query.

        • Hide match_none attributes Show match_none attributes object
          • boost number

            Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.

          • _name string
        • Analyzes the text and creates a phrase query out of the analyzed text.

        • Returns documents that contain the words of a provided text, in the same order as provided. The last term of the provided text is treated as a prefix, matching any words that begin with that term.

        • Hide more_like_this attributes Show more_like_this attributes object
          • boost number

            Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.

          • _name string
          • analyzer string

            The analyzer that is used to analyze the free form text. Defaults to the analyzer associated with the first field in fields.

          • Each term in the formed query could be further boosted by their tf-idf score. This sets the boost factor to use when using this feature. Defaults to deactivated (0).

          • Controls whether the query should fail (throw an exception) if any of the specified fields are not of the supported types (text or keyword).

          • fields array[string]

            Path to field or array of paths. Some API's support wildcards in the path to select multiple fields.

          • include boolean

            Specifies whether the input documents should also be included in the search results returned.

          • The maximum document frequency above which the terms are ignored from the input document.

          • The maximum number of query terms that can be selected.

          • The maximum word length above which the terms are ignored. Defaults to unbounded (0).

          • The minimum document frequency below which the terms are ignored from the input document.

          • The minimum term frequency below which the terms are ignored from the input document.

          • The minimum word length below which the terms are ignored.

          • routing string
          • version number
          • Values are internal, external, external_gte, or force.

        • Hide multi_match attributes Show multi_match attributes object
          • boost number

            Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.

          • _name string
          • analyzer string

            Analyzer used to convert the text in the query value into tokens.

          • If true, match phrase queries are automatically created for multi-term synonyms.

          • cutoff_frequency number Deprecated
          • fields string | array[string]
          • If true, edits for fuzzy matching include transpositions of two adjacent characters (for example, ab to ba). Can be applied to the term subqueries constructed for all terms but the final term.

          • lenient boolean

            If true, format-based errors, such as providing a text query value for a numeric field, are ignored.

          • Maximum number of terms to which the query will expand.

          • operator string

            Values are and, AND, or, or OR.

          • Number of beginning characters left unchanged for fuzzy matching.

          • query string Required

            Text, number, boolean value or date you wish to find in the provided field.

          • slop number

            Maximum number of positions allowed between matching tokens.

          • Determines how scores for each per-term blended query and scores across groups are combined.

          • type string

            Values are best_fields, most_fields, cross_fields, phrase, phrase_prefix, or bool_prefix.

          • Values are all or none.

        • nested object
          Hide nested attributes Show nested attributes object
          • boost number

            Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.

          • _name string
          • Indicates whether to ignore an unmapped path and not return any documents instead of an error.

          • path string Required

            Path to field or array of paths. Some API's support wildcards in the path to select multiple fields.

          • query object Required
          • Values are none, avg, sum, max, or min.

        • Hide parent_id attributes Show parent_id attributes object
          • boost number

            Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.

          • _name string
          • id string
          • Indicates whether to ignore an unmapped type and not return any documents instead of an error.

          • type string
        • Hide percolate attributes Show percolate attributes object
          • boost number

            Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.

          • _name string
          • document object

            The source of the document being percolated.

          • documents array[object]

            An array of sources of the documents being percolated.

          • field string Required

            Path to field or array of paths. Some API's support wildcards in the path to select multiple fields.

          • id string
          • index string
          • name string

            The suffix used for the _percolator_document_slot field when multiple percolate queries are specified.

          • Preference used to fetch document to percolate.

          • routing string
          • version number
        • pinned object
          Hide pinned attributes Show pinned attributes object
          • boost number

            Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.

          • _name string
        • prefix object

          Returns documents that contain a specific prefix in a provided field.

        • Hide query_string attributes Show query_string attributes object
          • boost number

            Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.

          • _name string
          • If true, the wildcard characters * and ? are allowed as the first character of the query string.

          • analyzer string

            Analyzer used to convert text in the query string into tokens.

          • If true, the query attempts to analyze wildcard terms in the query string.

          • If true, match phrase queries are automatically created for multi-term synonyms.

          • Path to field or array of paths. Some API's support wildcards in the path to select multiple fields.

          • Values are and, AND, or, or OR.

          • If true, enable position increments in queries constructed from a query_string search.

          • escape boolean
          • fields array[string]

            Path to field or array of paths. Some API's support wildcards in the path to select multiple fields.

          • Maximum number of terms to which the query expands for fuzzy matching.

          • Number of beginning characters left unchanged for fuzzy matching.

          • If true, edits for fuzzy matching include transpositions of two adjacent characters (for example, ab to ba).

          • lenient boolean

            If true, format-based errors, such as providing a text value for a numeric field, are ignored.

          • Maximum number of automaton states required for the query.

          • Maximum number of positions allowed between matching tokens for phrases.

          • query string Required

            Query string you wish to parse and use for search.

          • Analyzer used to convert quoted text in the query string into tokens. For quoted text, this parameter overrides the analyzer specified in the analyzer parameter.

          • Suffix appended to quoted text in the query string. You can use this suffix to use a different analysis method for exact matches.

          • rewrite string
          • How to combine the queries generated from the individual search terms in the resulting dis_max query.

          • type string

            Values are best_fields, most_fields, cross_fields, phrase, phrase_prefix, or bool_prefix.

        • range object

          Returns documents that contain terms within a provided range.

        • Hide rank_feature attributes Show rank_feature attributes object
          • boost number

            Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.

          • _name string
          • field string Required

            Path to field or array of paths. Some API's support wildcards in the path to select multiple fields.

        • regexp object

          Returns documents that contain terms matching a regular expression.

        • rule object
          Hide rule attributes Show rule attributes object
          • boost number

            Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.

          • _name string
          • organic object Required
          • ruleset_ids array[string] Required
          • match_criteria object Required
        • script object
          Hide script attributes Show script attributes object
          • boost number

            Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.

          • _name string
          • script object Required
        • Hide script_score attributes Show script_score attributes object
          • boost number

            Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.

          • _name string
          • Documents with a score lower than this floating point number are excluded from the search results.

          • query object Required
          • script object Required
        • semantic object
          Hide semantic attributes Show semantic attributes object
          • boost number

            Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.

          • _name string
          • field string Required

            The field to query, which must be a semantic_text field type

          • query string Required

            The query text

        • shape object
          Hide shape attributes Show shape attributes object
          • boost number

            Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.

          • _name string
          • When set to true the query ignores an unmapped field and will not match any documents.

        • Hide simple_query_string attributes Show simple_query_string attributes object
          • boost number

            Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.

          • _name string
          • analyzer string

            Analyzer used to convert text in the query string into tokens.

          • If true, the query attempts to analyze wildcard terms in the query string.

          • If true, the parser creates a match_phrase query for each multi-position token.

          • Values are and, AND, or, or OR.

          • fields array[string]

            Path to field or array of paths. Some API's support wildcards in the path to select multiple fields.

          • Maximum number of terms to which the query expands for fuzzy matching.

          • Number of beginning characters left unchanged for fuzzy matching.

          • If true, edits for fuzzy matching include transpositions of two adjacent characters (for example, ab to ba).

          • lenient boolean

            If true, format-based errors, such as providing a text value for a numeric field, are ignored.

          • query string Required

            Query string in the simple query string syntax you wish to parse and use for search.

          • Suffix appended to quoted text in the query string.

        • Hide span_containing attributes Show span_containing attributes object
          • boost number

            Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.

          • _name string
          • big object Required
          • little object Required
        • Hide span_field_masking attributes Show span_field_masking attributes object
          • boost number

            Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.

          • _name string
          • field string Required

            Path to field or array of paths. Some API's support wildcards in the path to select multiple fields.

          • query object Required
        • Hide span_first attributes Show span_first attributes object
          • boost number

            Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.

          • _name string
          • end number Required

            Controls the maximum end position permitted in a match.

          • match object Required
        • Hide span_multi attributes Show span_multi attributes object
          • boost number

            Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.

          • _name string
          • match object Required
        • Hide span_near attributes Show span_near attributes object
          • boost number

            Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.

          • _name string
          • clauses array[object] Required

            Array of one or more other span type queries.

          • in_order boolean

            Controls whether matches are required to be in-order.

          • slop number

            Controls the maximum number of intervening unmatched positions permitted.

        • span_not object
          Hide span_not attributes Show span_not attributes object
          • boost number

            Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.

          • _name string
          • dist number

            The number of tokens from within the include span that can’t have overlap with the exclude span. Equivalent to setting both pre and post.

          • exclude object Required
          • include object Required
          • post number

            The number of tokens after the include span that can’t have overlap with the exclude span.

          • pre number

            The number of tokens before the include span that can’t have overlap with the exclude span.

        • span_or object
          Hide span_or attributes Show span_or attributes object
          • boost number

            Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.

          • _name string
          • clauses array[object] Required

            Array of one or more other span type queries.

        • Matches spans containing a term.

        • Hide span_within attributes Show span_within attributes object
          • boost number

            Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.

          • _name string
          • big object Required
          • little object Required
        • Hide sparse_vector attributes Show sparse_vector attributes object
          • boost number

            Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.

          • _name string
        • term object

          Returns documents that contain an exact term in a provided field. To return a document, the query term must exactly match the queried field's value, including whitespace and capitalization.

        • terms object
          Hide terms attributes Show terms attributes object
          • boost number

            Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.

          • _name string
        • Returns documents that contain a minimum number of exact terms in a provided field. To return a document, a required number of terms must exactly match the field values, including whitespace and capitalization.

        • text_expansion object Deprecated

          Uses a natural language processing model to convert the query text into a list of token-weight pairs which are then used in a query against a sparse vector or rank features field.

        • weighted_tokens object Deprecated

          Supports returning text_expansion query results by sending in precomputed tokens with the query.

        • wildcard object

          Returns documents that contain terms matching a wildcard pattern.

        • wrapper object
          Hide wrapper attributes Show wrapper attributes object
          • boost number

            Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.

          • _name string
          • query string Required

            A base64 encoded query. The binary data format can be any of JSON, YAML, CBOR or SMILE encodings

        • type object
          Hide type attributes Show type attributes object
          • boost number

            Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.

          • _name string
          • value string Required
      • is_hidden boolean

        If true, the alias is hidden. All indices for the alias must have the same is_hidden value.

      • If true, the index is the write index for the alias.

      • routing string
    • mappings object
      Hide mappings attributes Show mappings attributes object
    • settings object
      Hide settings attributes Show settings attributes object
      • index object
      • mode string
      • Hide soft_deletes attributes Show soft_deletes attributes object
        • enabled boolean

          Indicates whether soft deletes are enabled on the index.

        • Hide retention_lease attribute Show retention_lease attribute object
          • period string Required

            A duration. Units can be nanos, micros, ms (milliseconds), s (seconds), m (minutes), h (hours) and d (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.

      • sort object
        Hide sort attributes Show sort attributes object
      • Values are true, false, or checksum.

      • codec string
      • routing_partition_size number | string

        Some APIs will return values such as numbers also as a string (notably epoch timestamps). This behavior is used to capture this behavior while keeping the semantics of the field type.

        Depending on the target language, code generators can keep the union or remove it and leniently parse strings to the target type.

      • merge object
        Hide merge attribute Show merge attribute object
      • A duration. Units can be nanos, micros, ms (milliseconds), s (seconds), m (minutes), h (hours) and d (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.

      • blocks object
        Hide blocks attributes Show blocks attributes object
      • analyze object
        Hide analyze attribute Show analyze attribute object
      • Hide highlight attribute Show highlight attribute object
      • routing object
        Hide routing attributes Show routing attributes object
      • A duration. Units can be nanos, micros, ms (milliseconds), s (seconds), m (minutes), h (hours) and d (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.

      • Hide lifecycle attributes Show lifecycle attributes object
        • name string
        • indexing_complete boolean | string

          Some APIs will return values such as numbers also as a string (notably epoch timestamps). This behavior is used to capture this behavior while keeping the semantics of the field type.

          Depending on the target language, code generators can keep the union or remove it and leniently parse strings to the target type.

        • If specified, this is the timestamp used to calculate the index age for its phase transitions. Use this setting if you create a new index that contains old data and want to use the original creation date to calculate the index age. Specified as a Unix epoch value in milliseconds.

        • Set to true to parse the origination date from the index name. This origination date is used to calculate the index age for its phase transitions. The index name must match the pattern .*-{date_format}-\d+, where the date_format is yyyy.MM.dd and the trailing digits are optional. An index that was rolled over would normally match the full format, for example logs-2016.10.31-000002). If the index name doesn’t match the pattern, index creation fails.

        • step object
          Hide step attribute Show step attribute object
          • A duration. Units can be nanos, micros, ms (milliseconds), s (seconds), m (minutes), h (hours) and d (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.

        • The index alias to update when the index rolls over. Specify when using a policy that contains a rollover action. When the index rolls over, the alias is updated to reflect that the index is no longer the write index. For more information about rolling indices, see Rollover.

      • creation_date number | string

        Some APIs will return values such as numbers also as a string (notably epoch timestamps). This behavior is used to capture this behavior while keeping the semantics of the field type.

        Depending on the target language, code generators can keep the union or remove it and leniently parse strings to the target type.

      • creation_date_string string | number

        A date and time, either as a string whose format can depend on the context (defaulting to ISO 8601), or a number of milliseconds since the Epoch. Elasticsearch accepts both as input, but will generally output a string representation.

      • uuid string
      • version object
        Hide version attributes Show version attributes object
      • translog object
        Hide translog attributes Show translog attributes object
      • Hide query_string attribute Show query_string attribute object
      • analysis object
        Hide analysis attributes Show analysis attributes object
      • settings object
      • Hide time_series attributes Show time_series attributes object
      • queries object
        Hide queries attribute Show queries attribute object
        • cache object
          Hide cache attribute Show cache attribute object
      • Configure custom similarity settings to customize how search results are scored.

      • mapping object
        Hide mapping attributes Show mapping attributes object
        • coerce boolean
        • Hide total_fields attributes Show total_fields attributes object
          • limit number

            The maximum number of fields in an index. Field and object mappings, as well as field aliases count towards this limit. The limit is in place to prevent mappings and searches from becoming too large. Higher values can lead to performance degradations and memory issues, especially in clusters with a high load or few resources.

          • This setting determines what happens when a dynamically mapped field would exceed the total fields limit. When set to false (the default), the index request of the document that tries to add a dynamic field to the mapping will fail with the message Limit of total fields [X] has been exceeded. When set to true, the index request will not fail. Instead, fields that would exceed the limit are not added to the mapping, similar to dynamic: false. The fields that were not added to the mapping will be added to the _ignored field.

        • depth object
          Hide depth attribute Show depth attribute object
          • limit number

            The maximum depth for a field, which is measured as the number of inner objects. For instance, if all fields are defined at the root object level, then the depth is 1. If there is one object mapping, then the depth is 2, etc.

        • Hide nested_fields attribute Show nested_fields attribute object
          • limit number

            The maximum number of distinct nested mappings in an index. The nested type should only be used in special cases, when arrays of objects need to be queried independently of each other. To safeguard against poorly designed mappings, this setting limits the number of unique nested types per index.

        • Hide nested_objects attribute Show nested_objects attribute object
          • limit number

            The maximum number of nested JSON objects that a single document can contain across all nested types. This limit helps to prevent out of memory errors when a document contains too many nested objects.

        • Hide field_name_length attribute Show field_name_length attribute object
          • limit number

            Setting for the maximum length of a field name. This setting isn’t really something that addresses mappings explosion but might still be useful if you want to limit the field length. It usually shouldn’t be necessary to set this setting. The default is okay unless a user starts to add a huge number of fields with really long names. Default is Long.MAX_VALUE (no limit).

        • Hide dimension_fields attribute Show dimension_fields attribute object
          • limit number

            [preview] This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.

      • Hide indexing.slowlog attributes Show indexing.slowlog attributes object
        • level string
        • source number
        • reformat boolean
        • Hide threshold attribute Show threshold attribute object
          • index object
            Hide index attributes Show index attributes object
            • warn string

              A duration. Units can be nanos, micros, ms (milliseconds), s (seconds), m (minutes), h (hours) and d (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.

            • info string

              A duration. Units can be nanos, micros, ms (milliseconds), s (seconds), m (minutes), h (hours) and d (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.

            • debug string

              A duration. Units can be nanos, micros, ms (milliseconds), s (seconds), m (minutes), h (hours) and d (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.

            • trace string

              A duration. Units can be nanos, micros, ms (milliseconds), s (seconds), m (minutes), h (hours) and d (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.

      • Hide indexing_pressure attribute Show indexing_pressure attribute object
        • memory object Required
          Hide memory attribute Show memory attribute object
          • limit number

            Number of outstanding bytes that may be consumed by indexing requests. When this limit is reached or exceeded, the node will reject new coordinating and primary operations. When replica operations consume 1.5x this limit, the node will reject new replica operations. Defaults to 10% of the heap.

      • store object
        Hide store attributes Show store attributes object
        • type string Required

        • allow_mmap boolean

          You can restrict the use of the mmapfs and the related hybridfs store type via the setting node.store.allow_mmap. This is a boolean setting indicating whether or not memory-mapping is allowed. The default is to allow it. This setting is useful, for example, if you are in an environment where you can not control the ability to create a lot of memory maps so you need disable the ability to use memory-mapping.

    • defaults object
      Hide defaults attributes Show defaults attributes object
      • index object
      • mode string
      • Hide soft_deletes attributes Show soft_deletes attributes object
        • enabled boolean

          Indicates whether soft deletes are enabled on the index.

        • Hide retention_lease attribute Show retention_lease attribute object
          • period string Required

            A duration. Units can be nanos, micros, ms (milliseconds), s (seconds), m (minutes), h (hours) and d (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.

      • sort object
        Hide sort attributes Show sort attributes object
      • Values are true, false, or checksum.

      • codec string
      • routing_partition_size number | string

        Some APIs will return values such as numbers also as a string (notably epoch timestamps). This behavior is used to capture this behavior while keeping the semantics of the field type.

        Depending on the target language, code generators can keep the union or remove it and leniently parse strings to the target type.

      • merge object
        Hide merge attribute Show merge attribute object
      • A duration. Units can be nanos, micros, ms (milliseconds), s (seconds), m (minutes), h (hours) and d (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.

      • blocks object
        Hide blocks attributes Show blocks attributes object
      • analyze object
        Hide analyze attribute Show analyze attribute object
      • Hide highlight attribute Show highlight attribute object
      • routing object
        Hide routing attributes Show routing attributes object
      • A duration. Units can be nanos, micros, ms (milliseconds), s (seconds), m (minutes), h (hours) and d (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.

      • Hide lifecycle attributes Show lifecycle attributes object
        • name string
        • indexing_complete boolean | string

          Some APIs will return values such as numbers also as a string (notably epoch timestamps). This behavior is used to capture this behavior while keeping the semantics of the field type.

          Depending on the target language, code generators can keep the union or remove it and leniently parse strings to the target type.

        • If specified, this is the timestamp used to calculate the index age for its phase transitions. Use this setting if you create a new index that contains old data and want to use the original creation date to calculate the index age. Specified as a Unix epoch value in milliseconds.

        • Set to true to parse the origination date from the index name. This origination date is used to calculate the index age for its phase transitions. The index name must match the pattern .*-{date_format}-\d+, where the date_format is yyyy.MM.dd and the trailing digits are optional. An index that was rolled over would normally match the full format, for example logs-2016.10.31-000002). If the index name doesn’t match the pattern, index creation fails.

        • step object
          Hide step attribute Show step attribute object
          • A duration. Units can be nanos, micros, ms (milliseconds), s (seconds), m (minutes), h (hours) and d (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.

        • The index alias to update when the index rolls over. Specify when using a policy that contains a rollover action. When the index rolls over, the alias is updated to reflect that the index is no longer the write index. For more information about rolling indices, see Rollover.

      • creation_date number | string

        Some APIs will return values such as numbers also as a string (notably epoch timestamps). This behavior is used to capture this behavior while keeping the semantics of the field type.

        Depending on the target language, code generators can keep the union or remove it and leniently parse strings to the target type.

      • creation_date_string string | number

        A date and time, either as a string whose format can depend on the context (defaulting to ISO 8601), or a number of milliseconds since the Epoch. Elasticsearch accepts both as input, but will generally output a string representation.

      • uuid string
      • version object
        Hide version attributes Show version attributes object
      • translog object
        Hide translog attributes Show translog attributes object
      • Hide query_string attribute Show query_string attribute object
      • analysis object
        Hide analysis attributes Show analysis attributes object
      • settings object
      • Hide time_series attributes Show time_series attributes object
      • queries object
        Hide queries attribute Show queries attribute object
        • cache object
          Hide cache attribute Show cache attribute object
      • Configure custom similarity settings to customize how search results are scored.

      • mapping object
        Hide mapping attributes Show mapping attributes object
        • coerce boolean
        • Hide total_fields attributes Show total_fields attributes object
          • limit number

            The maximum number of fields in an index. Field and object mappings, as well as field aliases count towards this limit. The limit is in place to prevent mappings and searches from becoming too large. Higher values can lead to performance degradations and memory issues, especially in clusters with a high load or few resources.

          • This setting determines what happens when a dynamically mapped field would exceed the total fields limit. When set to false (the default), the index request of the document that tries to add a dynamic field to the mapping will fail with the message Limit of total fields [X] has been exceeded. When set to true, the index request will not fail. Instead, fields that would exceed the limit are not added to the mapping, similar to dynamic: false. The fields that were not added to the mapping will be added to the _ignored field.

        • depth object
          Hide depth attribute Show depth attribute object
          • limit number

            The maximum depth for a field, which is measured as the number of inner objects. For instance, if all fields are defined at the root object level, then the depth is 1. If there is one object mapping, then the depth is 2, etc.

        • Hide nested_fields attribute Show nested_fields attribute object
          • limit number

            The maximum number of distinct nested mappings in an index. The nested type should only be used in special cases, when arrays of objects need to be queried independently of each other. To safeguard against poorly designed mappings, this setting limits the number of unique nested types per index.

        • Hide nested_objects attribute Show nested_objects attribute object
          • limit number

            The maximum number of nested JSON objects that a single document can contain across all nested types. This limit helps to prevent out of memory errors when a document contains too many nested objects.

        • Hide field_name_length attribute Show field_name_length attribute object
          • limit number

            Setting for the maximum length of a field name. This setting isn’t really something that addresses mappings explosion but might still be useful if you want to limit the field length. It usually shouldn’t be necessary to set this setting. The default is okay unless a user starts to add a huge number of fields with really long names. Default is Long.MAX_VALUE (no limit).

        • Hide dimension_fields attribute Show dimension_fields attribute object
          • limit number

            [preview] This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.

      • Hide indexing.slowlog attributes Show indexing.slowlog attributes object
        • level string
        • source number
        • reformat boolean
        • Hide threshold attribute Show threshold attribute object
          • index object
            Hide index attributes Show index attributes object
            • warn string

              A duration. Units can be nanos, micros, ms (milliseconds), s (seconds), m (minutes), h (hours) and d (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.

            • info string

              A duration. Units can be nanos, micros, ms (milliseconds), s (seconds), m (minutes), h (hours) and d (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.

            • debug string

              A duration. Units can be nanos, micros, ms (milliseconds), s (seconds), m (minutes), h (hours) and d (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.

            • trace string

              A duration. Units can be nanos, micros, ms (milliseconds), s (seconds), m (minutes), h (hours) and d (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.

      • Hide indexing_pressure attribute Show indexing_pressure attribute object
        • memory object Required
          Hide memory attribute Show memory attribute object
          • limit number

            Number of outstanding bytes that may be consumed by indexing requests. When this limit is reached or exceeded, the node will reject new coordinating and primary operations. When replica operations consume 1.5x this limit, the node will reject new replica operations. Defaults to 10% of the heap.

      • store object
        Hide store attributes Show store attributes object
        • type string Required

        • allow_mmap boolean

          You can restrict the use of the mmapfs and the related hybridfs store type via the setting node.store.allow_mmap. This is a boolean setting indicating whether or not memory-mapping is allowed. The default is to allow it. This setting is useful, for example, if you are in an environment where you can not control the ability to create a lot of memory maps so you need disable the ability to use memory-mapping.

    • Hide lifecycle attributes Show lifecycle attributes object
      • A duration. Units can be nanos, micros, ms (milliseconds), s (seconds), m (minutes), h (hours) and d (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.

      • Hide downsampling attribute Show downsampling attribute object
        • rounds array[object] Required

          The list of downsampling rounds to execute as part of this downsampling configuration

          Hide rounds attributes Show rounds attributes object
          • after string Required

            A duration. Units can be nanos, micros, ms (milliseconds), s (seconds), m (minutes), h (hours) and d (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.

          • config object Required
            Hide config attribute Show config attribute object
            • fixed_interval string Required

              A date histogram interval. Similar to Duration with additional units: w (week), M (month), q (quarter) and y (year)

  • version number
  • _meta object
    Hide _meta attributes Show _meta attributes object
  • deprecated boolean

    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.

Responses

  • 200 application/json
    Hide response attribute Show response attribute object
    • acknowledged boolean Required

      For a successful response, this value is always true. On failure, an exception is returned instead.

PUT /_component_template/{name}
curl \
 -X PUT http://api.example.com/_component_template/{name} \
 -H "Content-Type: application/json" \
 -d '{"template":{"aliases":{"filter":{"":{"boost":42.0,"_name":"string","value":"string"},"common":{},"fuzzy":{},"intervals":{},"match":{},"match_bool_prefix":{},"match_phrase":{},"match_phrase_prefix":{},"prefix":{},"range":{},"regexp":{},"span_term":{},"term":{},"terms_set":{},"text_expansion":{},"weighted_tokens":{},"wildcard":{}},"index_routing":"string","is_hidden":true,"is_write_index":true,"routing":"string","search_routing":"string"},"mappings":{"all_field":{"analyzer":"string","enabled":true,"omit_norms":true,"search_analyzer":"string","similarity":"string","store":true,"store_term_vector_offsets":true,"store_term_vector_payloads":true,"store_term_vector_positions":true,"store_term_vectors":true},"date_detection":true,"dynamic":"strict","dynamic_date_formats":["string"],"dynamic_templates":[{}],"_field_names":{"enabled":true},"index_field":{"enabled":true},"_meta":{"key":{}},"numeric_detection":true,"properties":{},"_routing":{"required":true},"_size":{"enabled":true},"_source":{"compress":true,"compress_threshold":"string","enabled":true,"excludes":["string"],"includes":["string"],"mode":"disabled"},"runtime":{"fields":{"type":"boolean"},"fetch_fields":[{"field":"string","format":"string"}],"format":"string","input_field":"string","target_field":"string","target_index":"string","script":{"source":"string","id":"string","params":{"key":{}},"":"painless","options":{"key":"string"}},"type":"boolean"},"enabled":true,"subobjects":true,"_data_stream_timestamp":{"enabled":true}},"settings":{"index":{},"mode":"string","routing_path":"string","soft_deletes":{"enabled":true,"retention_lease":{"period":"string"}},"sort":{"field":"string","order":"asc","mode":"min","missing":"_last"},"number_of_shards":42.0,"number_of_replicas":42.0,"number_of_routing_shards":42.0,"check_on_startup":"true","codec":"string","":"string","load_fixed_bitset_filters_eagerly":true,"hidden":true,"auto_expand_replicas":"string","merge":{"scheduler":{"":42.0}},"search":{"idle":{"after":"string"},"slowlog":{"level":"string","source":42.0,"reformat":true,"threshold":{"query":{"warn":"string","info":"string","debug":"string","trace":"string"},"fetch":{"warn":"string","info":"string","debug":"string","trace":"string"}}}},"refresh_interval":"string","max_result_window":42.0,"max_inner_result_window":42.0,"max_rescore_window":42.0,"max_docvalue_fields_search":42.0,"max_script_fields":42.0,"max_ngram_diff":42.0,"max_shingle_diff":42.0,"blocks":{"":true},"max_refresh_listeners":42.0,"analyze":{"":42.0},"highlight":{"max_analyzed_offset":42.0},"max_terms_count":42.0,"max_regex_length":42.0,"routing":{"allocation":{"enable":"all","include":{"_tier_preference":"string","_id":"string"},"initial_recovery":{"_id":"string"},"disk":{"threshold_enabled":true}},"rebalance":{"enable":"all"}},"gc_deletes":"string","default_pipeline":"string","final_pipeline":"string","lifecycle":{"name":"string","":true,"origination_date":42.0,"parse_origination_date":true,"step":{"wait_time_threshold":"string"},"rollover_alias":"string"},"provided_name":"string","uuid":"string","version":{"created":"string","created_string":"string"},"verified_before_close":true,"format":"string","max_slices_per_scroll":42.0,"translog":{"sync_interval":"string","durability":"request","":42.0,"retention":{"":42.0,"age":"string"}},"query_string":{"":true},"priority":42.0,"top_metrics_max_size":42.0,"analysis":{"analyzer":{},"char_filter":{},"filter":{},"normalizer":{},"tokenizer":{}},"settings":{},"time_series":{"":"string"},"queries":{"cache":{"enabled":true}},"similarity":{},"mapping":{"coerce":true,"total_fields":{"limit":42.0,"ignore_dynamic_beyond_limit":true},"depth":{"limit":42.0},"nested_fields":{"limit":42.0},"nested_objects":{"limit":42.0},"field_name_length":{"limit":42.0},"dimension_fields":{"limit":42.0},"ignore_malformed":true},"indexing.slowlog":{"level":"string","source":42.0,"reformat":true,"threshold":{"index":{"warn":"string","info":"string","debug":"string","trace":"string"}}},"indexing_pressure":{"memory":{"limit":42.0}},"store":{"":"fs","allow_mmap":true}},"defaults":{"index":{},"mode":"string","routing_path":"string","soft_deletes":{"enabled":true,"retention_lease":{"period":"string"}},"sort":{"field":"string","order":"asc","mode":"min","missing":"_last"},"number_of_shards":42.0,"number_of_replicas":42.0,"number_of_routing_shards":42.0,"check_on_startup":"true","codec":"string","":"string","load_fixed_bitset_filters_eagerly":true,"hidden":true,"auto_expand_replicas":"string","merge":{"scheduler":{"":42.0}},"search":{"idle":{"after":"string"},"slowlog":{"level":"string","source":42.0,"reformat":true,"threshold":{"query":{"warn":"string","info":"string","debug":"string","trace":"string"},"fetch":{"warn":"string","info":"string","debug":"string","trace":"string"}}}},"refresh_interval":"string","max_result_window":42.0,"max_inner_result_window":42.0,"max_rescore_window":42.0,"max_docvalue_fields_search":42.0,"max_script_fields":42.0,"max_ngram_diff":42.0,"max_shingle_diff":42.0,"blocks":{"":true},"max_refresh_listeners":42.0,"analyze":{"":42.0},"highlight":{"max_analyzed_offset":42.0},"max_terms_count":42.0,"max_regex_length":42.0,"routing":{"allocation":{"enable":"all","include":{"_tier_preference":"string","_id":"string"},"initial_recovery":{"_id":"string"},"disk":{"threshold_enabled":true}},"rebalance":{"enable":"all"}},"gc_deletes":"string","default_pipeline":"string","final_pipeline":"string","lifecycle":{"name":"string","":true,"origination_date":42.0,"parse_origination_date":true,"step":{"wait_time_threshold":"string"},"rollover_alias":"string"},"provided_name":"string","uuid":"string","version":{"created":"string","created_string":"string"},"verified_before_close":true,"format":"string","max_slices_per_scroll":42.0,"translog":{"sync_interval":"string","durability":"request","":42.0,"retention":{"":42.0,"age":"string"}},"query_string":{"":true},"priority":42.0,"top_metrics_max_size":42.0,"analysis":{"analyzer":{},"char_filter":{},"filter":{},"normalizer":{},"tokenizer":{}},"settings":{},"time_series":{"":"string"},"queries":{"cache":{"enabled":true}},"similarity":{},"mapping":{"coerce":true,"total_fields":{"limit":42.0,"ignore_dynamic_beyond_limit":true},"depth":{"limit":42.0},"nested_fields":{"limit":42.0},"nested_objects":{"limit":42.0},"field_name_length":{"limit":42.0},"dimension_fields":{"limit":42.0},"ignore_malformed":true},"indexing.slowlog":{"level":"string","source":42.0,"reformat":true,"threshold":{"index":{"warn":"string","info":"string","debug":"string","trace":"string"}}},"indexing_pressure":{"memory":{"limit":42.0}},"store":{"":"fs","allow_mmap":true}},"data_stream":"string","lifecycle":{"data_retention":"string","downsampling":{"rounds":[{"after":"string","config":{"fixed_interval":"string"}}]}}},"version":42.0,"_meta":{"key":{}},"deprecated":true}'