Skip to content

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

@moesterheld

Description

@moesterheld

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");
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions