Simulate index API
editSimulate index API
editThis 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.
Returns the index configuration that would be applied to the specified index from an existing index template.
POST /_index_template/_simulate_index/my-index-000001
Request
editPOST /_index_template/_simulate_index/<index>
Prerequisites
edit-
If the Elasticsearch security features are enabled, you must have the
manage_index_templates
ormanage
cluster privilege to use this API.
Path parameters
edit-
<index>
- (Required, string) Name of the index to simulate.
Query parameters
edit-
master_timeout
-
(Optional, time units)
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. Defaults to
30s
.
Response body
edit-
overlapping
-
(array) Any templates that also matched the index but were superseded by a higher-priority template. Response includes an empty array if there are no overlapping templates.
Properties of
overlapping
-
name
- (string) Name of the superseded template.
-
index_patterns
- (array) Index patterns that the superseded template applies to.
-
-
template
-
(object) The settings, mappings, and aliases that would be applied to the index.
Properties of
template
-
aliases
-
(Optional, alias object) Index aliases which include the index. See Update index alias.
Response includes an empty object if no aliases would be applied.
-
mappings
-
(Optional, mapping object) Mapping for fields in the index. If specified, this mapping can include:
- Field names
- Field data types
- Mapping parameters
See Mapping.
Omitted from the response if no mappings would be applied.
-
settings
-
(Optional, index setting object) Configuration options for the index. See Index Settings.
Response includes an empty object if no settings would be applied.
-
Examples
editThe following example shows the configuration that would be applied to my-index-000001
by
an existing template.
PUT /_component_template/ct1 { "template": { "settings": { "index.number_of_shards": 2 } } } PUT /_component_template/ct2 { "template": { "settings": { "index.number_of_replicas": 0 }, "mappings": { "properties": { "@timestamp": { "type": "date" } } } } } PUT /_index_template/final-template { "index_patterns": ["my-index-*"], "composed_of": ["ct1", "ct2"], "priority": 5 } POST /_index_template/_simulate_index/my-index-000001
Create a component template ( |
|
Create a second component template ( |
|
Create an index template ( |
|
Show the configuration that would be applied to |
The response shows the index settings, mappings, and aliases applied by the final-template
:
{ "template" : { "settings" : { "index" : { "number_of_shards" : "2", "number_of_replicas" : "0" } }, "mappings" : { "properties" : { "@timestamp" : { "type" : "date" } } }, "aliases" : { } }, "overlapping" : [ { "name" : "template_1", "index_patterns" : [ "my-index-*" ] } ] }