opensearch-project / opensearch-project/opensearch-java

[FEATURE] Support for Dynamic Template Variables

Open
#585 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug enhancement good first issue
Dominant language
Java
Stars
165
Forks
250
Avg merge
1d 18h
Merged PRs (30d)
26

Description

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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/Property.java at the referenced v2.4.0 location, then trace how dynamic templates and mapping properties are represented. Compare the current model with the example using {dynamic_type}; done means dynamic template creation can express that variable and the client serializes it correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend-api-design
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.