opensearch-project / opensearch-project/opensearch-java
[BUG] Indices with a PathHierarchyTokenizer without optional config params cannot be deserialized
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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