Simulate an index template Generally available

POST /_index_template/_simulate

Get the index configuration that would be applied by a particular index template.

Required authorization

  • Cluster privileges: manage_index_templates

Query parameters

  • create boolean

    If true, the template passed in the body is only used if no existing templates match the same index patterns. If false, the simulation uses the template with the highest priority. Note that the template is not permanently added or updated in either case; it is only used for the simulation.

  • cause string

    User defined reason for dry-run creating the new template for simulation purposes

  • master_timeout string

    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.

    Values are -1 or 0.

    External documentation
  • include_defaults boolean Generally available; Added in 8.11.0

    If true, returns all relevant default configurations for the index template.

application/json

Body

  • allow_auto_create boolean

    This setting overrides the value of the action.auto_create_index cluster setting. If set to true in a template, then indices can be automatically created using that template even if auto-creation of indices is disabled via actions.auto_create_index. If set to false, then indices or data streams matching the template must always be explicitly created, and may never be automatically created.

  • index_patterns string | array[string]

    Array of wildcard (*) expressions used to match the names of data streams and indices during creation.

  • composed_of array[string]

    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.

  • template object

    Template to be applied. It may optionally include an aliases, mappings, or settings configuration.

    Hide template attributes Show template attributes object
    • aliases object

      Aliases to add. If the index template includes a data_stream object, these are data stream aliases. Otherwise, these are index aliases. Data stream aliases ignore the index_routing, routing, and search_routing options.

      Hide aliases attribute Show aliases attribute object
      • * object Additional properties
        Hide * attributes Show * attributes object
        • filter object

          Query used to limit documents the alias can access.

          External documentation
          Hide filter attributes Show filter attributes object
          • common object Deprecated
          • fuzzy object

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

          • geo_grid object

            Matches geo_point and geo_shape values that intersect a grid cell from a GeoGrid aggregation.

          • intervals object

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

          • match object

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

          • match_bool_prefix object

            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.

          • match_phrase object

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

          • match_phrase_prefix object

            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.

          • prefix object

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

          • range object

            Returns documents that contain terms within a provided range.

          • regexp object

            Returns documents that contain terms matching a regular expression.

          • span_term object

            Matches spans containing a term.

          • 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_set object

            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 Generally available; Added in 8.8.0

            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 Generally available; Added in 8.13.0

            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.

        • index_routing string

          Value used to route indexing operations to a specific shard. If specified, this overwrites the routing value for indexing operations.

        • is_hidden boolean

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

          Default value is false.

        • is_write_index boolean

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

          Default value is false.

        • routing string

          Value used to route indexing and search operations to a specific shard.

        • search_routing string

          Value used to route search operations to a specific shard. If specified, this overwrites the routing value for search operations.

    • mappings object

      Mapping for fields in the index. If specified, this mapping can include field names, field data types, and mapping parameters.

      Hide mappings attributes Show mappings attributes object
      • all_field object
        Hide all_field attributes Show all_field attributes object
        • analyzer string Required
        • enabled boolean Required
        • omit_norms boolean Required
        • search_analyzer string Required
        • similarity string Required
        • store boolean Required
        • store_term_vector_offsets boolean Required
        • store_term_vector_payloads boolean Required
        • store_term_vector_positions boolean Required
        • store_term_vectors boolean Required
      • date_detection boolean
      • dynamic string

        Values are strict, runtime, true, or false.

      • dynamic_date_formats array[string]
      • dynamic_templates array[object]
      • _field_names object
        Hide _field_names attribute Show _field_names attribute object
        • enabled boolean Required
      • index_field object
        Hide index_field attribute Show index_field attribute object
        • enabled boolean Required
      • _meta object
        Hide _meta attribute Show _meta attribute object
        • * object Additional properties
      • numeric_detection boolean
      • properties object
      • _routing object
        Hide _routing attribute Show _routing attribute object
        • required boolean Required
      • _size object
        Hide _size attribute Show _size attribute object
        • enabled boolean Required
      • _source object
        Hide _source attributes Show _source attributes object
        • compress boolean
        • compress_threshold string
        • enabled boolean
        • excludes array[string]
        • includes array[string]
      • runtime object
        Hide runtime attribute Show runtime attribute object
        • * object Additional properties
          Hide * attributes Show * attributes object
          • fields object

            For type composite

          • fetch_fields array[object]

            For type lookup

          • format string

            A custom format for date type runtime fields.

      • enabled boolean
      • subobjects string

        Values are true or false.

      • _data_stream_timestamp object Generally available; Added in 7.16.0
        Hide _data_stream_timestamp attribute Show _data_stream_timestamp attribute object
        • enabled boolean Required
    • settings object

      Configuration options for the index.

      Hide settings attributes Show settings attributes object
      • index object
      • mode string
      • routing_path string | array[string]

      • soft_deletes object
        Hide soft_deletes attribute Show soft_deletes attribute object
        • enabled boolean

          Indicates whether soft deletes are enabled on the index.

          Default value is true.

      • sort object
        Hide sort attributes Show sort attributes object
        • order
        • mode
        • missing
      • number_of_shards number | string Generally available

        One of:

        Default value is 1.

        Default value is 1.

      • number_of_replicas number | string Generally available

        One of:

        Default value is 0.

        Default value is 0.

      • number_of_routing_shards number
      • check_on_startup string

        Values are true, false, or checksum.

      • codec string

        Default value is LZ4.

      • routing_partition_size number | string

      • load_fixed_bitset_filters_eagerly boolean

        Default value is true.

      • hidden boolean | string

        One of:

        Default value is false.

        Default value is false.

      • auto_expand_replicas string | null

        One of:

        Default value is false.

        A null value that is to be interpreted as an actual value, unless other uses of null that are equivalent to a missing value. It is used for exemple in settings, where using the NullValue for a setting will reset it to its default value.

      • merge object
      • refresh_interval 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.

        External documentation
      • max_result_window number

        Default value is 10000.0.

      • max_inner_result_window number

        Default value is 100.0.

      • max_rescore_window number

        Default value is 10000.0.

      • max_script_fields number

        Default value is 32.0.

      • max_ngram_diff number

        Default value is 1.0.

      • max_shingle_diff number

        Default value is 3.0.

      • blocks object
      • max_refresh_listeners number
      • analyze object

        Settings to define analyzers, tokenizers, token filters and character filters. Refer to the linked documentation for step-by-step examples of updating analyzers on existing indices.

        External documentation
      • highlight object
        Hide highlight attribute Show highlight attribute object
        • max_analyzed_offset number

          Default value is 1000000.0.

      • max_terms_count number

        Default value is 65536.0.

      • max_regex_length number

        Default value is 1000.0.

      • routing object
      • gc_deletes 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.

        External documentation
      • default_pipeline string
      • final_pipeline string
      • lifecycle object
        Hide lifecycle attributes Show lifecycle attributes object
        • origination_date number

          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.

          Default value is 0.0.

        • parse_origination_date boolean

          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.

        • rollover_alias string

          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.

          Default value is empty.

        • prefer_ilm
      • provided_name string
      • creation_date string
      • creation_date_string string
      • uuid string
      • version object
        Hide version attribute Show version attribute object
        • created_string string
      • verified_before_close boolean | string

      • format string | number

      • max_slices_per_scroll number
      • translog object
      • query_string object
      • priority number | string

      • top_metrics_max_size number
      • analysis object
        Hide analysis attributes Show analysis attributes object
        • analyzer object
        • char_filter object
        • filter object
        • normalizer object
        • tokenizer object
      • settings object
      • time_series object
      • queries object
      • similarity object

        Configure custom similarity settings to customize how search results are scored.

      • mapping object

        Enable or disable dynamic mapping for an index.

        Hide mapping attributes Show mapping attributes object
        • coerce boolean
        • ignore_malformed
      • indexing.slowlog object
        Hide indexing.slowlog attributes Show indexing.slowlog attributes object
        • level string
        • source number
        • reformat boolean
      • indexing_pressure object

        Configure indexing back pressure limits.

      • store object

        The store module allows you to control how index data is stored and accessed on disk.

        Hide store attribute Show store attribute object
        • 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.

    • lifecycle object Generally available; Added in 8.11.0

      Data stream lifecycle denotes that a data stream is managed by the data stream lifecycle and contains the configuration.

      Hide lifecycle attributes Show lifecycle attributes object
      • data_retention string

        If defined, every document added to this data stream will be stored at least for this time frame. Any time after this duration the document could be deleted. When empty, every document in this data stream will be stored indefinitely.

        External documentation
      • downsampling array[object]

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

        Hide downsampling attributes Show downsampling attributes object
        • after
        • fixed_interval
      • downsampling_method string

        The method used to downsample the data. There are two options aggregate and last_value. It requires downsampling to be defined. Defaults to aggregate.

        Values are aggregate or last_value.

      • enabled boolean

        If defined, it turns data stream lifecycle on/off (true/false) for this data stream. A data stream lifecycle that's disabled (enabled: false) will have no effect on the data stream.

        Default value is true.

      • frozen_after string

        Only available with feature flag dlm_searchable_snapshots.

        External documentation
    • data_stream_options object | string | null Generally available; Added in 8.19.0

      One of:
  • data_stream object

    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 a data_stream object.

    Hide data_stream attributes Show data_stream attributes object
    • hidden boolean
    • allow_custom_routing boolean
    • failure_store boolean
  • priority number

    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.

  • version number

    Version number used to manage index templates externally. This number is not automatically generated by Elasticsearch.

  • _meta object

    Optional user metadata about the index template. May have any contents. This map is not automatically generated by Elasticsearch.

    Hide _meta attribute Show _meta attribute object
    • * object Additional properties
  • ignore_missing_component_templates array[string]

    The configuration option ignore_missing_component_templates can be used when an index template references a component template that might not exist

  • 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 attributes Show response attributes object
    • overlapping array[object]
      Hide overlapping attributes Show overlapping attributes object
      • name string Required
      • index_patterns array[string] Required
    • template object Required
      Hide template attributes Show template attributes object
      • aliases object Required
        Hide aliases attribute Show aliases attribute object
        • * object Additional properties
          Hide * attributes Show * attributes object
          • filter object

            Query used to limit documents the alias can access.

          • index_routing string

            Value used to route indexing operations to a specific shard. If specified, this overwrites the routing value for indexing operations.

          • is_hidden boolean

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

            Default value is false.

          • is_write_index boolean

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

            Default value is false.

          • routing string

            Value used to route indexing and search operations to a specific shard.

          • search_routing string

            Value used to route search operations to a specific shard. If specified, this overwrites the routing value for search operations.

      • mappings object Required
        Hide mappings attributes Show mappings attributes object
        • all_field object
        • date_detection boolean
        • dynamic string

          Values are strict, runtime, true, or false.

        • dynamic_date_formats array[string]
        • dynamic_templates array[object]
        • _field_names object
        • index_field object
        • _meta object
        • numeric_detection boolean
        • properties object
        • _routing object
        • _size object
        • _source object
        • runtime object
          Hide runtime attribute Show runtime attribute object
          • * object Additional properties
        • enabled boolean
        • subobjects string

          Values are true or false.

        • _data_stream_timestamp object
      • settings object Required
        Hide settings attributes Show settings attributes object
        • index object
        • mode string
        • routing_path string | array[string]

        • soft_deletes object
        • sort object
        • number_of_shards number | string Generally available

          One of:

          Default value is 1.

          Default value is 1.

        • number_of_replicas number | string Generally available

          One of:

          Default value is 0.

          Default value is 0.

        • number_of_routing_shards number
        • check_on_startup string

          Values are true, false, or checksum.

        • codec string

          Default value is LZ4.

        • routing_partition_size
        • load_fixed_bitset_filters_eagerly boolean

          Default value is true.

        • hidden boolean | string

          One of:

          Default value is false.

          Default value is false.

        • auto_expand_replicas string | null

          One of:

          Default value is false.

          A null value that is to be interpreted as an actual value, unless other uses of null that are equivalent to a missing value. It is used for exemple in settings, where using the NullValue for a setting will reset it to its default value.

        • merge object
        • refresh_interval 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.

        • max_result_window number

          Default value is 10000.0.

        • max_inner_result_window number

          Default value is 100.0.

        • max_rescore_window number

          Default value is 10000.0.

        • max_script_fields number

          Default value is 32.0.

        • max_ngram_diff number

          Default value is 1.0.

        • max_shingle_diff number

          Default value is 3.0.

        • blocks object
        • max_refresh_listeners number
        • analyze object

          Settings to define analyzers, tokenizers, token filters and character filters. Refer to the linked documentation for step-by-step examples of updating analyzers on existing indices.

        • highlight object
        • max_terms_count number

          Default value is 65536.0.

        • max_regex_length number

          Default value is 1000.0.

        • routing object
        • gc_deletes 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.

        • default_pipeline string
        • final_pipeline string
        • lifecycle object
        • provided_name string
        • creation_date
        • creation_date_string
        • uuid string
        • version object
        • verified_before_close boolean | string

        • format string | number

        • max_slices_per_scroll number
        • translog object
        • query_string object
        • priority number | string

        • top_metrics_max_size number
        • analysis object
        • settings object
        • time_series object
        • queries object
        • similarity object

          Configure custom similarity settings to customize how search results are scored.

        • mapping object

          Enable or disable dynamic mapping for an index.

        • indexing.slowlog object
        • indexing_pressure object

          Configure indexing back pressure limits.

        • store object

          The store module allows you to control how index data is stored and accessed on disk.

POST /_index_template/_simulate
curl \
 --request POST 'http://api.example.com/_index_template/_simulate' \
 --header "Content-Type: application/json" \
 --data '"{\n  \"index_patterns\": [\"my-index-*\"],\n  \"composed_of\": [\"ct2\"],\n  \"priority\": 10,\n  \"template\": {\n    \"settings\": {\n      \"index.number_of_replicas\": 1\n    }\n  }\n}"'
Request example
To see what settings will be applied by a template before you add it to the cluster, you can pass a template configuration in the request body. The specified template is used for the simulation if it has a higher priority than existing templates.
{
  "index_patterns": ["my-index-*"],
  "composed_of": ["ct2"],
  "priority": 10,
  "template": {
    "settings": {
      "index.number_of_replicas": 1
    }
  }
}
Response examples (200)
A successful response from `POST /_index_template/_simulate` with a template configuration in the request body. The response shows any overlapping templates with a lower priority.
{
  "template" : {
    "settings" : {
      "index" : {
        "number_of_replicas" : "1",
        "routing" : {
          "allocation" : {
            "include" : {
              "_tier_preference" : "data_content"
            }
          }
        }
      }
    },
    "mappings" : {
      "properties" : {
        "@timestamp" : {
          "type" : "date"
        }
      }
    },
    "aliases" : { }
  },
  "overlapping" : [
    {
      "name" : "final-template",
      "index_patterns" : [
        "my-index-*"
      ]
    }
  ]
}