Query parameters

  • createboolean

    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.

  • causestring

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

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

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

application/json

Body

  • 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_patternsstring | array[string]
  • composed_ofarray[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.

  • templateobject
    Hide template attributes Show template attributes object
    • aliasesobject

      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
    • mappingsobject
      Hide mappings attributes Show mappings attributes object
      • all_fieldobject
        Hide all_field attributes Show all_field attributes object
      • dynamicstring

        Values are strict, runtime, true, or false.

      • dynamic_templatesarray[object]
      • Hide _field_names attribute Show _field_names attribute object
      • Hide index_field attribute Show index_field attribute object
      • _metaobject
        Hide _meta attribute Show _meta attribute object
        • *object Additional properties
      • _routingobject
        Hide _routing attribute Show _routing attribute object
      • _sizeobject
        Hide _size attribute Show _size attribute object
      • _sourceobject
        Hide _source attributes Show _source attributes object
      • runtimeobject
        Hide runtime attribute Show runtime attribute object
        • *object Additional properties
          Hide * attributes Show * attributes object
          • fieldsobject

            For type composite

            Hide fields attribute Show fields attribute object
            • *object Additional properties
              Hide * attribute Show * attribute object
              • typestring Required

                Values are boolean, composite, date, double, geo_point, geo_shape, ip, keyword, long, or lookup.

          • fetch_fieldsarray[object]

            For type lookup

            Hide fetch_fields attributes Show fetch_fields attributes object
            • fieldstring Required

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

            • formatstring
          • formatstring

            A custom format for date type runtime fields.

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

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

          • scriptobject
            Hide script attributes Show script attributes object
            • sourcestring

              The script source.

            • idstring
            • paramsobject

              Specifies any named parameters that are passed into the script as variables. Use parameters instead of hard-coded values to decrease compile time.

              Hide params attribute Show params attribute object
              • *object Additional properties
            • langstring

              Any of:

              Values are painless, expression, mustache, or java.

            • optionsobject
              Hide options attribute Show options attribute object
              • *string Additional properties
          • typestring Required

            Values are boolean, composite, date, double, geo_point, geo_shape, ip, keyword, long, or lookup.

      • enabledboolean
      • Values are true or false.

      • Hide _data_stream_timestamp attribute Show _data_stream_timestamp attribute object
    • settingsobject
      Index settings
    • lifecycleobject

      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
      • 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
        • roundsarray[object] Required

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

          Hide rounds attributes Show rounds attributes object
          • afterstring 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.

          • configobject Required
            Hide config attribute Show config attribute object
            • fixed_intervalstring Required

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

      • enabledboolean

        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.

  • Hide data_stream attributes Show data_stream attributes object
  • prioritynumber

    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.

  • versionnumber
  • _metaobject
    Hide _meta attribute Show _meta attribute object
    • *object Additional properties
  • The configuration option ignore_missing_component_templates can be used when an index template references a component template that might not exist

  • deprecatedboolean

    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

POST /_index_template/_simulate
curl \
 --request POST 'http://api.example.com/_index_template/_simulate' \
 --header "Authorization: $API_KEY" \
 --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-*"
      ]
    }
  ]
}