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 'GeoBoundsAggregate.bounds' #1091

Closed
TatianaNeuer opened this issue Jul 17, 2024 · 2 comments · Fixed by #1238
Labels
bug Something isn't working

Comments

@TatianaNeuer
Copy link

What is the bug?

When performing a geo bounds aggregation on a null field, the response cannot be deserialized. This is the error:

org.opensearch.client.util.MissingRequiredPropertyException: Missing required property 'GeoBoundsAggregate.bounds'

	at org.opensearch.client.util.ApiTypeHelper.requireNonNull(ApiTypeHelper.java:89)
	at org.opensearch.client.opensearch._types.aggregations.GeoBoundsAggregate.<init>(GeoBoundsAggregate.java:57)
	at org.opensearch.client.opensearch._types.aggregations.GeoBoundsAggregate.<init>(GeoBoundsAggregate.java:49)
	at org.opensearch.client.opensearch._types.aggregations.GeoBoundsAggregate$Builder.build(GeoBoundsAggregate.java:126)
	at org.opensearch.client.opensearch._types.aggregations.GeoBoundsAggregate$Builder.build(GeoBoundsAggregate.java:94)
	at org.opensearch.client.json.ObjectBuilderDeserializer.deserialize(ObjectBuilderDeserializer.java:98)
	at org.opensearch.client.json.DelegatingDeserializer$SameType.deserialize(DelegatingDeserializer.java:60)
	at org.opensearch.client.json.ExternallyTaggedUnion$Deserializer.deserialize(ExternallyTaggedUnion.java:94)
	at org.opensearch.client.json.ExternallyTaggedUnion$TypedKeysDeserializer.deserializeEntry(ExternallyTaggedUnion.java:136)
	at org.opensearch.client.json.ExternallyTaggedUnion$TypedKeysDeserializer.deserialize(ExternallyTaggedUnion.java:119)
	at org.opensearch.client.json.ExternallyTaggedUnion$TypedKeysDeserializer.deserialize(ExternallyTaggedUnion.java:106)
	at org.opensearch.client.json.JsonpDeserializer.deserialize(JsonpDeserializer.java:87)
	at org.opensearch.client.json.ObjectDeserializer$FieldObjectDeserializer.deserialize(ObjectDeserializer.java:81)
	at org.opensearch.client.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:185)
	at org.opensearch.client.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:146)
	at org.opensearch.client.json.JsonpDeserializer.deserialize(JsonpDeserializer.java:87)
	at org.opensearch.client.json.ObjectBuilderDeserializer.deserialize(ObjectBuilderDeserializer.java:91)
	at org.opensearch.client.json.DelegatingDeserializer$SameType.deserialize(DelegatingDeserializer.java:55)
	at org.opensearch.client.transport.endpoints.EndpointWithResponseMapperAttr$1.deserialize(EndpointWithResponseMapperAttr.java:68)
	at org.opensearch.client.transport.rest_client.RestClientTransport.decodeResponse(RestClientTransport.java:360)
	at org.opensearch.client.transport.rest_client.RestClientTransport.getHighLevelResponse(RestClientTransport.java:326)
	at org.opensearch.client.transport.rest_client.RestClientTransport.performRequest(RestClientTransport.java:148)
	at org.opensearch.client.opensearch.OpenSearchClient.search(OpenSearchClient.java:1381)

How can one reproduce the bug?

Configure a template mapping with a geo_point field:

"mappings": {
      "properties": {
        "location": {
          "properties": {
            "coordinates": {
              "type": "geo_point"
            }
          }
        }
      }
    }

Index a document without the geo_point field:

Map<String, String> indexData = Map.of("first_name", "Bruce");
IndexRequest<Map> indexRequest = new IndexRequest.Builder<Map>().index("index_test").id("1").document(indexData).build();
        openSearchClient.index(indexRequest);

Perform a geo_bounds aggregation:

org.opensearch.client.opensearch.core.SearchResponse<Object> result = openSearchClient.search(
                org.opensearch.client.opensearch.core.SearchRequest.of(s -> s.index("index_test")
                        .aggregations("box", b -> b.geoBounds(g -> g.field("location.coordinates")))), Object.class);

What is the expected behavior?

Deserialize the response and not throwing an exception

What is your host/environment?

Opensearch 2.15.0
org.opensearch.client:opensearch-java:2.11.1

Do you have any additional context?

Here is the aggregation part of the response from opensearch, it does not contain a "bounds" field:

"aggregations": {
		"geo_bounds#box": {}
}

The bug seems similar to #520 but on GeoBoundsAggregate

@TatianaNeuer TatianaNeuer added bug Something isn't working untriaged labels Jul 17, 2024
@dblock dblock removed the untriaged label Aug 5, 2024
@dblock
Copy link
Member

dblock commented Aug 5, 2024

[Catch All Triage - 1, 2, 3]

@Xtansia
Copy link
Collaborator

Xtansia commented Oct 22, 2024

@TatianaNeuer A fix for this has been released in version 2.16.0, could you please confirm this resolves your issue?

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

Successfully merging a pull request may close this issue.

3 participants