There's a disconnect for this, the "dynamic" type used for match_mapping_type
is the type of the field, not necessarily the ES type. For instance, match_mapping_type
only supports "long", not "integer" because it maps to the data type rather than an ES type. So even though ES itself uses "text" and "keyword", the data type is still a "string".
I agree this is confusing, there was a PR here: Elasticsearch should reject dynamic templates with unknown `match_mapping_type`. by jpountz · Pull Request #17285 · elastic/elasticsearch · GitHub for 5.0+ that adds deprecation logging for this, and I opened Throw an exception on unrecognized "match_mapping_type" by dakrone · Pull Request #22090 · elastic/elasticsearch · GitHub so 6.0 will throw an exception when an unrecognized type is used.