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

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:

{
  "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
            }
			}
          }
        }
	}
}

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

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

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*"
  ]
}

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?

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.