opensearch-project / opensearch-project/opensearch-java

[BUG] invalid `dynamic_template` (includes auto-generated `"type": "object"`)

Open
#1,513 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

see https://github.com/opensearch-project/spring-data-opensearch/issues/437
this seems to come from this client

What is the bug?

using dynamic_template generates a wrong template (it includes "type": "object") which then leads to wrong behaviour when ingesting field names with dots in it.

the problem seems to come from here:
https://github.com/opensearch-project/opensearch-java/blob/61567fa5b67ab62880a5f503b5cf1bcea31af562/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/Property.java#L1440

which was previously here (got moved around in a recent re-generation):
https://github.com/opensearch-project/opensearch-java/blob/39552405c07a685fa4d0c29995895439db1d2682/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/Property.java#L1494

How can one reproduce the bug?

see https://github.com/opensearch-project/spring-data-opensearch/issues/437

What is the expected behavior?

the provided example works both with the old and new client. more concretely: opensearch-java mustn't inject "type": "object" into the dynamic_template

What is your host/environment?

n/a

Do you have any screenshots?

n/a

Do you have any additional context?

n/a

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 in java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/Property.java around the dynamic_template handling at the referenced line, comparing it with the previous location. Reproduce the example from spring-data-opensearch issue 437 and inspect the generated template. Done means opensearch-java no longer injects "type": "object" into dynamic_template.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.