opensearch-project / opensearch-project/opensearch-java
[BUG] Missing Required Property `Builder.<variant kind>`
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?
When I attempt to make a openSearchClient.indices().get(indexRequest) call with a valid index that should return multiple results, I am met with a MissingRequiredPropertyException from the client.
This bug is nearly identical to the closed issue detailed here - https://github.com/elastic/elasticsearch-java/issues/249.
My setup is almost identical to the setup described in this forum post, the only difference being that my call is a .get() -
String index = "index_a*"; // imagine indexing pattern being 'index_a0, index_a1, index_b0' etc
List<String> indices = new ArrayList<>();
List<ExpandWildcard> wildcards = new ArrayList<>();
wildcards.add(ExpandWildcard.All);
indices.add(index);
GetIndexRequest request = new GetIndexRequest.Builder().expandWildCards(wildcards).index(indices).build();
GetIndexResponse response = openSearchClient.indices.get(request); // <-- exception thrown here
However, this exception is NOT thrown when I do the following -
String index = "index_a*"; // imagine indexing pattern being 'index_a0, index_a1, index_b0' etc
List<String> indices = new ArrayList<>();
List<ExpandWildcard> wildcards = new ArrayList<>();
wildcards.add(ExpandWildcard.All);
indices.add(index);
GetIndexRequest request = new GetIndexRequest.Builder().expandWildCards(wildcards).index(indices).build();
ApiTypeHelper.DANGEROUS_disableRequiredPropertiesCheck(true);
GetIndexResponse response = openSearchClient.indices.get(request); // <--no exception thrown here
ApiTypeHelper.DANGEROUS_disableRequiredPropertiesCheck(false);
When this is executed, I receive the expected results of the query.
This workaround was recommended by ElasticSearch documentation here.
I suspect that whichever version of the elastic client that operates under the hood in the version I am using (2.6.0) needs to be updated.
How can one reproduce the bug?
I am unsure how to reproduce this consistently, as it is intermittent in occurrence. I have also had it happen with a .index() call on the client, but that went away as I continued to work and I could not get it to be reproduced.
What is the expected behavior?
I expected to see two viable indexes returned in the response to my query.
What is your host/environment?
Mac OS Ventura 3.4.1
OpenSearch Java Client 2.6.0
Java 11
Connected to AWS as described here; can insert indexes and documents without issue
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 by inspecting the OpenSearch Java Client 2.6.0 behavior at GetIndexRequest.Builder and the openSearchClient.indices.get entry point, then compare it with the linked Elasticsearch issue and missing-required-property documentation. Reproduce the wildcard request with multiple matching indexes and verify that it returns the expected response without disabling required-property checks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100