Simulate index API

This functionality is experimental and may be changed or removed completely in a future release. Elastic will take a best effort approach to fix any issues, but experimental features 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.

  1. POST /_index_template/_simulate_index/my-index-000001

Request

POST /_index_template/_simulate_index/<index>

Path parameters

<index>

(Required, string) Name of the index to simulate.

Query parameters

master_timeout

(Optional, time units) Specifies the period of time 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

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

Examples

The following example shows the configuration that would be applied to my-index-000001 by an existing template.

  1. PUT /_component_template/ct1
  2. {
  3. "template": {
  4. "settings": {
  5. "index.number_of_shards": 2
  6. }
  7. }
  8. }
  9. PUT /_component_template/ct2
  10. {
  11. "template": {
  12. "settings": {
  13. "index.number_of_replicas": 0
  14. },
  15. "mappings": {
  16. "properties": {
  17. "@timestamp": {
  18. "type": "date"
  19. }
  20. }
  21. }
  22. }
  23. }
  24. PUT /_index_template/final-template
  25. {
  26. "index_patterns": ["my-index-*"],
  27. "composed_of": ["ct1", "ct2"],
  28. "priority": 5
  29. }
  30. POST /_index_template/_simulate_index/my-index-000001

Create a component template (ct1) that sets the number of shards to 2

Create a second component template (ct2) that sets the number of replicas to 0 and defines a mapping

Create an index template (final-template) that uses the component templates

Show the configuration that would be applied to my-index-000001

The response shows the index settings, mappings, and aliases applied by the final-template:

  1. {
  2. "template" : {
  3. "settings" : {
  4. "index" : {
  5. "number_of_shards" : "2",
  6. "number_of_replicas" : "0"
  7. }
  8. },
  9. "mappings" : {
  10. "properties" : {
  11. "@timestamp" : {
  12. "type" : "date"
  13. }
  14. }
  15. },
  16. "aliases" : { }
  17. },
  18. "overlapping" : [
  19. {
  20. "name" : "template_1",
  21. "index_patterns" : [
  22. "my-index-*"
  23. ]
  24. }
  25. ]
  26. }