# Error when creating Index Template: composable template \[ \] template after composition is invalid

**URL:** <https://discuss.elastic.co/t/error-when-creating-index-template-composable-template-template-after-composition-is-invalid/327948>\
**Category:** Kibana\
**Created:** [March 17, 2023, 3:24pm UTC](https://discuss.elastic.co/t/error-when-creating-index-template-composable-template-template-after-composition-is-invalid/327948 "2023-03-17T15:24:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mark\_S](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_s/32/98686_2.png) [@Mark\_S](https://discuss.elastic.co/u/Mark_S)\
**Post date:** [March 17, 2023, 3:24pm UTC](https://discuss.elastic.co/t/error-when-creating-index-template-composable-template-template-after-composition-is-invalid/327948/1 "2023-03-17T15:24:37Z")

</div>

When creating an Index Template, I get this error:  
Error when creating Template: composable template template after composition is invalid

I observe that:

1. This error occurs only when I use the normal index template. If I use the Legacy Template then it is created without any problems

1. If I completely remove the mappings, then the template is created ok. (but later on I still cannot add the mapping)

Here the mapping:

```auto
{
  "mappings": {   
      "properties": {
        "@version": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "@timestamp": {
          "type": "date"
        },
        "application_server": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "application_server2": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "application_server3": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
			}
          }
        }
	}
}

```

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [March 17, 2023, 6:27pm UTC](https://discuss.elastic.co/t/error-when-creating-index-template-composable-template-template-after-composition-is-invalid/327948/2 "2023-03-17T18:27:11Z")

</div>

What is the endpoint you are using? Can you share the entire template, not just the mappings?

---

<div class="post-metadata">

**Author:** ![Mark\_S](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_s/32/98686_2.png) [@Mark\_S](https://discuss.elastic.co/u/Mark_S)\
**Post date:** [March 18, 2023, 5:12pm UTC](https://discuss.elastic.co/t/error-when-creating-index-template-composable-template-template-after-composition-is-invalid/327948/3 "2023-03-18T17:12:11Z")

</div>

When using the UI to create the template I got the error.  
However it seems ok to create it with PUT (!)

```auto
PUT _index_template/test_template
{
  "template": {
    "settings": {
      "index": {
        "lifecycle": {
          "name": "Testindexpolicy",
          "rollover_alias": "index_from_logstash_test_alias"
        },
        "number_of_replicas": "0"
      }
    },
    "mappings": {
      "properties": {
        "@version": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "@timestamp": {
          "type": "date"
        },
        "app_server": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "app_server2": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        }
      }
    },
    "aliases": {
      "test-search-all": {}
    }
  },
  "index_patterns": [
    "index_from_logstash_test_alias*"
  ]
}

```

---

<div class="post-metadata">

**Author:** ![jba](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jba/32/118482_2.png) [@jba](https://discuss.elastic.co/u/jba)\
**Post date:** [March 18, 2023, 5:38pm UTC](https://discuss.elastic.co/t/error-when-creating-index-template-composable-template-template-after-composition-is-invalid/327948/4 "2023-03-18T17:38:36Z")

</div>

Somewhere near the end of the (Kibana) UI for creating a new (composable) template there should be an option to view the resulting JSON data.

Does this result differ from the template that you can deploy using the Console (`PUT _index_template/xxxxxx`)?

Have you tried the `PUT _index_template/_simulate/xxxxxx` thingy to see what that tells you?

---

<div class="post-metadata">

**Author:** ![Mark\_S](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_s/32/98686_2.png) [@Mark\_S](https://discuss.elastic.co/u/Mark_S)\
**Post date:** [March 18, 2023, 5:59pm UTC](https://discuss.elastic.co/t/error-when-creating-index-template-composable-template-template-after-composition-is-invalid/327948/5 "2023-03-18T17:59:31Z")

</div>

Good idea, but when I used the UI, as soon as I pasted the mapping the JSON would not be generated and I would just see the error message.  
So what I did is this: I created the template with a simple mapping, and then got the JSON and replaced the mapping, and used PUT.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 15, 2023, 5:59pm UTC](https://discuss.elastic.co/t/error-when-creating-index-template-composable-template-template-after-composition-is-invalid/327948/6 "2023-04-15T17:59:49Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
