# New java client bug in GeoCentroidAggregation?

**URL:** <https://discuss.elastic.co/t/new-java-client-bug-in-geocentroidaggregation/312612>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [August 22, 2022, 11:18am UTC](https://discuss.elastic.co/t/new-java-client-bug-in-geocentroidaggregation/312612 "2022-08-22T11:18:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alain\_Bod](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alain_bod/32/77345_2.png) [@Alain\_Bod](https://discuss.elastic.co/u/Alain_Bod)\
**Post date:** [August 22, 2022, 11:18am UTC](https://discuss.elastic.co/t/new-java-client-bug-in-geocentroidaggregation/312612/1 "2022-08-22T11:18:42Z")

</div>

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:

```auto
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

```auto
{
    "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:

```auto
! 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?

---

<div class="post-metadata">

**Author:** ![swallez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/swallez/32/11972_2.png) [@swallez](https://discuss.elastic.co/u/swallez)\
**Post date:** [August 22, 2022, 12:16pm UTC](https://discuss.elastic.co/t/new-java-client-bug-in-geocentroidaggregation/312612/2 "2022-08-22T12:16:00Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![swallez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/swallez/32/11972_2.png) [@swallez](https://discuss.elastic.co/u/swallez)\
**Post date:** [August 22, 2022, 3:12pm UTC](https://discuss.elastic.co/t/new-java-client-bug-in-geocentroidaggregation/312612/3 "2022-08-22T15:12:54Z")

</div>

I opened [GeoBoundsAggregate.bounds should be optional · Issue #383 · elastic/elasticsearch-java · GitHub](https://github.com/elastic/elasticsearch-java/issues/383) to fix this. Please subscribe to the issue to track progress.

---

<div class="post-metadata">

**Author:** ![Alain\_Bod](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alain_bod/32/77345_2.png) [@Alain\_Bod](https://discuss.elastic.co/u/Alain_Bod)\
**Post date:** [August 22, 2022, 3:27pm UTC](https://discuss.elastic.co/t/new-java-client-bug-in-geocentroidaggregation/312612/4 "2022-08-22T15:27:17Z")

</div>

Thanks for your quick reply!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 19, 2022, 3:27pm UTC](https://discuss.elastic.co/t/new-java-client-bug-in-geocentroidaggregation/312612/5 "2022-09-19T15:27:23Z")

</div>

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