# Dynamic template create error in 8.14+ java, works in 8.12

**URL:** <https://discuss.elastic.co/t/dynamic-template-create-error-in-8-14-java-works-in-8-12/366639>\
**Category:** Elasticsearch\
**Created:** [September 16, 2024, 4:41pm UTC](https://discuss.elastic.co/t/dynamic-template-create-error-in-8-14-java-works-in-8-12/366639 "2024-09-16T16:41:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![MChambers](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mchambers/32/97650_2.png) [@MChambers](https://discuss.elastic.co/u/MChambers)\
**Post date:** [September 16, 2024, 4:41pm UTC](https://discuss.elastic.co/t/dynamic-template-create-error-in-8-14-java-works-in-8-12/366639/1 "2024-09-16T16:41:15Z")

</div>

When I try to create an index using a mapping that has a dynamic template that matches a type, I get this error:

```auto
[es/indices.create] failed: [mapper_parsing_exception] Failed to parse mapping: No field type matched on [[string]], possible values are [object, string, long, double, boolean, date, binary]

```

Here is example:

```auto
   "type_of_attribute": {
          "path_match": "attrs.*.type",
          "match_mapping_type": "string",
          "mapping": {
            "type": "keyword",
          }
        }

```

Works fine in 8.12.1 and seems to start failing with 8.14. It also works if I remove all type matching.

---

<div class="post-metadata">

**Author:** ![Kathleen\_DeRusso](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kathleen_derusso/32/132039_2.png) [@Kathleen\_DeRusso](https://discuss.elastic.co/u/Kathleen_DeRusso)\
**Post date:** [September 16, 2024, 8:08pm UTC](https://discuss.elastic.co/t/dynamic-template-create-error-in-8-14-java-works-in-8-12/366639/2 "2024-09-16T20:08:05Z")

</div>

From #Elastic Search to #Elasticsearch

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [September 17, 2024, 8:35am UTC](https://discuss.elastic.co/t/dynamic-template-create-error-in-8-14-java-works-in-8-12/366639/3 "2024-09-17T08:35:16Z")

</div>

Could you share a full reproduction script please?

---

<div class="post-metadata">

**Author:** ![ilgrosso](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ilgrosso/32/94485_2.png) [@ilgrosso](https://discuss.elastic.co/u/ilgrosso)\
**Post date:** [September 20, 2024, 9:29am UTC](https://discuss.elastic.co/t/dynamic-template-create-error-in-8-14-java-works-in-8-12/366639/4 "2024-09-20T09:29:40Z")

</div>

I am actually experiencing just the same as reported above.

I don't have a script to reproduce, but the exception as above pops up as soon as I call [this method](https://github.com/apache/syncope/blob/master/ext/elasticsearch/client-elasticsearch/src/main/java/org/apache/syncope/ext/elasticsearch/client/ElasticsearchIndexManager.java#L237) with [this mapping](https://github.com/apache/syncope/blob/master/ext/elasticsearch/client-elasticsearch/src/main/java/org/apache/syncope/ext/elasticsearch/client/ElasticsearchIndexManager.java#L130) and [these settings](https://github.com/apache/syncope/blob/master/ext/elasticsearch/client-elasticsearch/src/main/java/org/apache/syncope/ext/elasticsearch/client/ElasticsearchIndexManager.java#L102).

Just tested with 8.15.1 as well, same behavior.

FYI, it works up to 8.13.4.

---

<div class="post-metadata">

**Author:** ![ilgrosso](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ilgrosso/32/94485_2.png) [@ilgrosso](https://discuss.elastic.co/u/ilgrosso)\
**Post date:** [September 20, 2024, 10:03am UTC](https://discuss.elastic.co/t/dynamic-template-create-error-in-8-14-java-works-in-8-12/366639/5 "2024-09-20T10:03:03Z")

</div>

I have just discovered that the error as above was occurring because the ES cluster version was 8.11.3.  
Upgrading to 8.15.1 solves the problem.

---

<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:** [October 18, 2024, 10:03am UTC](https://discuss.elastic.co/t/dynamic-template-create-error-in-8-14-java-works-in-8-12/366639/6 "2024-10-18T10:03:05Z")

</div>

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