opensearch-project / opensearch-project/opensearch-java

[BUG] Indices with a PathHierarchyTokenizer without optional config params cannot be deserialized

Open
#1,797 3 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

What is the bug?

An index with a path hierarchy tokenizer that is configured with missing optional parameters (see https://docs.opensearch.org/latest/analyzers/tokenizers/path-hierarchy/) cannot be deserialized with an error.
E.g. Missing required property 'PathHierarchyTokenizer.bufferSize'

How can one reproduce the bug?
  • Create a index with path hierarchy tokenizer without setting optional parameters
  • Try to retrieve this index using the IndicesClient
What is the expected behavior?

Index should be retrieved without throwing an exception

What is your host/environment?

OS 2.19.3
Client 3.2.0 / 3.3.0

Do you have any screenshots?
java.lang.RuntimeException: Missing required property 'PathHierarchyTokenizer.bufferSize'
	at org.opensearch.client.transport.httpclient5.ApacheHttpClient5Transport.extractAndWrapCause(ApacheHttpClient5Transport.java:1168)
	at org.opensearch.client.transport.httpclient5.ApacheHttpClient5Transport.performRequest(ApacheHttpClient5Transport.java:159)
	at org.opensearch.client.opensearch.indices.OpenSearchIndicesClientBase.get(OpenSearchIndicesClientBase.java:468)
Do you have any additional context?

Caused by requireNonNull checks in PathHierarchyTokenizer for optional parameters

    private PathHierarchyTokenizer(Builder builder) {
        super(builder);
        this.bufferSize = ApiTypeHelper.requireNonNull(builder.bufferSize, this, "bufferSize");
        this.delimiter = ApiTypeHelper.requireNonNull(builder.delimiter, this, "delimiter");
        this.replacement = builder.replacement;
        this.reverse = ApiTypeHelper.requireNonNull(builder.reverse, this, "reverse");
        this.skip = ApiTypeHelper.requireNonNull(builder.skip, this, "skip");
    }

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 with the PathHierarchyTokenizer model and the IndicesClient retrieval path shown in the report, then inspect how tokenizer responses are deserialized and where the requireNonNull checks are applied. Reproduce the issue by retrieving an index whose path hierarchy tokenizer omits optional parameters; done means the index is retrieved without the missing-property exception.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.