opensearch-java icon indicating copy to clipboard operation
opensearch-java copied to clipboard

[FEATURE] Support for Dynamic Template Variables

Open cpatel-r7 opened this issue 3 years ago • 1 comments

Is your feature request related to a problem?

OpenSearch supports usage of Dynamic Template Variables (for e.g., {dynamic_type}), but the opensearch-java client does not have an option for it in this 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. For example, I would like to add a template variable in this dynamic template like so:

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

What solution would you like?

Add support for template variables, so they can be used when creating dynamic templates.

What alternatives have you considered?

In my specific case, I can use "dynamic" : "strict" on the root object to not allow adding any new dynamic fields. So, the alternatives can vary based on your specific circumstance.

Do you have any additional context?

cpatel-r7 avatar Jul 25 '23 17:07 cpatel-r7

For the context, https://www.elastic.co/guide/en/elasticsearch/reference/7.10/dynamic-templates.html#template-variables

reta avatar Jul 25 '23 18:07 reta