# Java API Client - Geo Bounding Box Query from Geohash

**URL:** <https://discuss.elastic.co/t/java-api-client-geo-bounding-box-query-from-geohash/358082>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [April 24, 2024, 5:08am UTC](https://discuss.elastic.co/t/java-api-client-geo-bounding-box-query-from-geohash/358082 "2024-04-24T05:08:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tschmidt01](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tschmidt01/32/133799_2.png) [@tschmidt01](https://discuss.elastic.co/u/tschmidt01)\
**Post date:** [April 24, 2024, 5:08am UTC](https://discuss.elastic.co/t/java-api-client-geo-bounding-box-query-from-geohash/358082/1 "2024-04-24T05:08:53Z")

</div>

Using the old java client you could create a geo bounding box query by just supplying a geohash like so:

```auto
QueryBuilders.geoBoundingBoxQuery("some-field")
                .setCorners("some-geo-hash")

```

Was this feature removed from the new Java API Client as now you would have to either supply `cords`, `tlbr`, `trbl` or `wkt` instead?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 24, 2024, 6:59am UTC](https://discuss.elastic.co/t/java-api-client-geo-bounding-box-query-from-geohash/358082/2 "2024-04-24T06:59:22Z")

</div>

Welcome!

Indeed. I can't see how to support [Geo-bounding box query | Elasticsearch Guide [8.13] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-bounding-box-query.html#_geohash_2) with the Java Client.

@ltrotta Do you know?

---

<div class="post-metadata">

**Author:** ![ltrotta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ltrotta/32/124003_2.png) [@ltrotta](https://discuss.elastic.co/u/ltrotta)\
**Post date:** [April 24, 2024, 8:18am UTC](https://discuss.elastic.co/t/java-api-client-geo-bounding-box-query-from-geohash/358082/3 "2024-04-24T08:18:35Z")

</div>

Hey! I have written [this](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-bounding-box-query.html#_bounding_box_as_well_known_text_wkt) query from the tutorial using the java client:

```auto
        esClient.search(sr -> sr
            .index("my_locations")
            .query(q -> q
                .bool(b -> b
                    .must(m -> m.matchAll(ma -> ma))
                    .filter(f -> f
                        .geoBoundingBox(g -> g
                            .field("pin.location")
                            .boundingBox(bb -> bb
                                .wkt(w -> w.wkt("BBOX (-74.1, -71.12, 40.73, 40.01)"))))))),Object.class);

```

The other options (cords,tlbr,trbl) can be set along with wkt as in this example.
