# Dynamic Template Variables not supported in OpenSearch Java client

**URL:** <https://forum.opensearch.org/t/dynamic-template-variables-not-supported-in-opensearch-java-client/15232>\
**Category:** OpenSearch Client Libraries\
**Tags:** opensearch-java\
**Created:** [July 24, 2023, 5:40pm UTC](https://forum.opensearch.org/t/dynamic-template-variables-not-supported-in-opensearch-java-client/15232 "2023-07-24T17:40:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![chintan\_patel](https://avatars.discourse-cdn.com/v4/letter/c/db5fbb/32.png) [@chintan\_patel](https://forum.opensearch.org/u/chintan_patel)\
**Post date:** [July 24, 2023, 5:40pm UTC](https://forum.opensearch.org/t/dynamic-template-variables-not-supported-in-opensearch-java-client/15232/1 "2023-07-24T17:40:30Z")

</div>

**Versions** (relevant - OpenSearch/Dashboard/Server OS/Browser):  
OpenSearch Version: 2.5.0  
OpenSearch Java Version: 2.4.0

**Describe the issue** :  
I am trying to create a dynamic template for a new index, and would like to use `{dynamic_type}` template variable in the following template like so:

```auto
{
   "mappings": {
      "dynamic_templates": [
         {
            "strict_mappings": {
               "mapping": {
                  "type": "{dynamic_type}",
                  "dynamic":"strict"
               },
               "match":"*"
            }
         }
      ]
   }
}

```

But, it looks like that the [Property class](https://github.com/opensearch-project/opensearch-java/blob/v2.4.0/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/Property.java) does not support adding a template variable. I would like this strict mapping for all the fields in an index. Is there any workaround for this or when will this be supported? Thank you!

---

<div class="post-metadata">

**Author:** ![reta](https://avatars.discourse-cdn.com/v4/letter/r/cdc98d/32.png) [@reta](https://forum.opensearch.org/u/reta)\
**Post date:** [July 25, 2023, 1:28pm UTC](https://forum.opensearch.org/t/dynamic-template-variables-not-supported-in-opensearch-java-client/15232/2 "2023-07-25T13:28:03Z")

</div>

Hi @chintan_patel , could you please open a feature request to `opensearch-java` [1]?  
Thank you.

[1] [GitHub - opensearch-project/opensearch-java: Java Client for OpenSearch](https://github.com/opensearch-project/openSearch-java)

---

<div class="post-metadata">

**Author:** ![chintan\_patel](https://avatars.discourse-cdn.com/v4/letter/c/db5fbb/32.png) [@chintan\_patel](https://forum.opensearch.org/u/chintan_patel)\
**Post date:** [July 25, 2023, 5:49pm UTC](https://forum.opensearch.org/t/dynamic-template-variables-not-supported-in-opensearch-java-client/15232/3 "2023-07-25T17:49:51Z")

</div>

Created new feature request here: [[FEATURE] Support for Dynamic Template Variables · Issue #585 · opensearch-project/opensearch-java · GitHub](https://github.com/opensearch-project/opensearch-java/issues/585)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/mauve_hedgehog/original/2X/3/33547ea01a5b12dcca2958411d3edd97ae2ea8c1.png) [@system](https://forum.opensearch.org/u/system)\
**Post date:** [September 23, 2023, 5:50pm UTC](https://forum.opensearch.org/t/dynamic-template-variables-not-supported-in-opensearch-java-client/15232/4 "2023-09-23T17:50:43Z")

</div>

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