New java client bug in GeoCentroidAggregation?

Hi,
I believe I ran into a bug with the new Java Client (v8.3.3)
I'm trying a GeoCentroidAggregation which returns 0 results. In that case I get an exception:

POST /dataset/_search?typed_keys=true {"_source":{"excludes":["params.ci*"],"includes":["*"]},"aggregations":{"field_bbox_value":{"geo_bounds":{"field":"geo_params.centroid"}}},"query":{"bool":{"filter":[{"bool":{"minimum_should_match":"1","should":[{"bool":{"filter":[{"range":{"params.startdate":{"lt":"0","format":"epoch_millis"}}}]}}]}},{"exists":{"field":"geo_params.centroid"}}]}},"size":0,"track_total_hits":true}

Returns

{
    "took": 1,
    "timed_out": false,
    "_shards": {
        "total": 1,
        "successful": 1,
        "skipped": 0,
        "failed": 0
    },
    "hits": {
        "total": {
            "value": 0,
            "relation": "eq"
        },
        "max_score": null,
        "hits": []
    },
    "aggregations": {
        "geo_bounds#field_bbox_value": {}
    }
}

And the Java client throws an exception:

! Causing: co.elastic.clients.json.JsonpMappingException: Error deserializing co.elastic.clients.elasticsearch.core.SearchResponse: co.elastic.clients.util.MissingRequiredPropertyException: Missing required property 'GeoBoundsAggregate.bounds' (JSON path: aggregations) (line no=1, column no=209, offset=-1)
! at co.elastic.clients.json.JsonpMappingException.from0(JsonpMappingException.java:134)
! at co.elastic.clients.json.JsonpMappingException.from(JsonpMappingException.java:121)
! at co.elastic.clients.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:206)
! at co.elastic.clients.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:136)
! at co.elastic.clients.json.JsonpDeserializer.deserialize(JsonpDeserializer.java:75)
! at co.elastic.clients.json.ObjectBuilderDeserializer.deserialize(ObjectBuilderDeserializer.java:79)
! at co.elastic.clients.json.DelegatingDeserializer$SameType.deserialize(DelegatingDeserializer.java:43)
! at co.elastic.clients.json.DelegatingDeserializer$SameType.deserialize(DelegatingDeserializer.java:43)
! at co.elastic.clients.transport.endpoints.EndpointWithResponseMapperAttr$1.deserialize(EndpointWithResponseMapperAttr.java:56)
! at co.elastic.clients.transport.rest_client.RestClientTransport.decodeResponse(RestClientTransport.java:328)
! at co.elastic.clients.transport.rest_client.RestClientTransport.getHighLevelResponse(RestClientTransport.java:294)
! at co.elastic.clients.transport.rest_client.RestClientTransport.performRequest(RestClientTransport.java:147)
! at co.elastic.clients.elasticsearch.ElasticsearchClient.search(ElasticsearchClient.java:1502)

Am I doing something wrong or is it a bug?

Thanks for the report, this is an issue that can certainly be attributed to the client. We'll check if this affects only GeoCentroidAggregation or also other aggregations to fix it correctly.

I opened GeoBoundsAggregate.bounds should be optional · Issue #383 · elastic/elasticsearch-java · GitHub to fix this. Please subscribe to the issue to track progress.

1 Like

Thanks for your quick reply!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.