Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] org.opensearch.client.util.MissingRequiredPropertyException: Missing required property 'MultiSearchItem.status' #520

Closed
javiermorant opened this issue Jun 6, 2023 · 2 comments · Fixed by #660
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@javiermorant
Copy link

What is the bug?

multi search is not working with multisearch template but it does with regular multisearch using programatic query.
Error :
msearchTemplate() throws MissingRequiredPropertyException

org.opensearch.client.util.MissingRequiredPropertyException: Missing required property 'MultiSearchItem.status'
	at org.opensearch.client.util.ApiTypeHelper.requireNonNull(ApiTypeHelper.java:88)
	at org.opensearch.client.opensearch.core.msearch.MultiSearchItem.<init>(MultiSearchItem.java:62)
	at org.opensearch.client.opensearch.core.msearch.MultiSearchItem$Builder.build(MultiSearchItem.java:119)
	at org.opensearch.client.opensearch.core.msearch.MultiSearchItem$Builder.build(MultiSearchItem.java:92)
	at org.opensearch.client.json.ObjectBuilderDeserializer.deserialize(ObjectBuilderDeserializer.java:99)
	at org.opensearch.client.json.UnionDeserializer$SingleMemberHandler.deserialize(UnionDeserializer.java:91)
	at org.opensearch.client.json.UnionDeserializer.deserialize(UnionDeserializer.java:324)
	at org.opensearch.client.json.JsonpDeserializerBase$ArrayDeserializer.deserialize(JsonpDeserializerBase.java:353)
	at org.opensearch.client.json.JsonpDeserializerBase$ArrayDeserializer.deserialize(JsonpDeserializerBase.java:322)
	at org.opensearch.client.json.JsonpDeserializer.deserialize(JsonpDeserializer.java:88)
	at org.opensearch.client.json.ObjectDeserializer$FieldObjectDeserializer.deserialize(ObjectDeserializer.java:85)
	at org.opensearch.client.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:189)
	at org.opensearch.client.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:150)
	at org.opensearch.client.json.JsonpDeserializer.deserialize(JsonpDeserializer.java:88)
	at org.opensearch.client.json.ObjectBuilderDeserializer.deserialize(ObjectBuilderDeserializer.java:92)
	at org.opensearch.client.json.DelegatingDeserializer$SameType.deserialize(DelegatingDeserializer.java:56)
	at org.opensearch.client.transport.endpoints.EndpointWithResponseMapperAttr$1.deserialize(EndpointWithResponseMapperAttr.java:69)
	at org.opensearch.client.transport.rest_client.RestClientTransport.decodeResponse(RestClientTransport.java:325)
	at org.opensearch.client.transport.rest_client.RestClientTransport.getHighLevelResponse(RestClientTransport.java:291)
	at org.opensearch.client.transport.rest_client.RestClientTransport.performRequest(RestClientTransport.java:144)
	at org.opensearch.client.opensearch.OpenSearchClient.msearchTemplate(OpenSearchClient.java:960)

How can one reproduce the bug?

perform a multisearch openSearchClient.msearchTemplate() method

What is the expected behavior?

Expected behavior is that there is a 200 response from opensearch with the results ready to be parsed

What is your host/environment?

local docker with opensearch version 2.5.0 running in Mac Os using java client from kotlin

Do you have any additional context?

Same issue was reported to elastic search here:
elastic/elasticsearch-java#110
and solved here:
elastic/elasticsearch-java@4a0aa08

@javiermorant javiermorant added bug Something isn't working untriaged labels Jun 6, 2023
@dblock
Copy link
Member

dblock commented Jun 6, 2023

@javiermorant Clear bug, thanks for reporting. Interested in making a PR to fix this? Please make sure to not bring in/looking at any non-APLv2 code.

@dblock dblock changed the title [BUG] [BUG] org.opensearch.client.util.MissingRequiredPropertyException: Missing required property 'MultiSearchItem.status' Jun 6, 2023
@wbeckler wbeckler removed the untriaged label Jun 9, 2023
@wbeckler wbeckler added the good first issue Good for newcomers label Sep 19, 2023
@Xtansia
Copy link
Collaborator

Xtansia commented Oct 10, 2023

Looks to be a really simple fix, just making status optional in https://github.com/opensearch-project/opensearch-java/blob/main/java-client/src/main/java/org/opensearch/client/opensearch/core/msearch/MultiSearchItem.java

  • Change type of status from int to Integer
  • Add @Nullable annotations
  • Remove ApiTypeHelper.requireNonNull check in constructor
  • Wrap serialization of status in if (this.status != null) {}
  • Remove "Required" prefix from JavaDoc comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants