[[java-query-dsl-geo-distance-query]]
==== Geo Distance Query

See {ref}/query-dsl-geo-distance-query.html[Geo Distance Query]

[source,java]
--------------------------------------------------
QueryBuilder qb = geoDistanceQuery("pin.location")  <1>
    .point(40, -70)                                 <2>
    .distance(200, DistanceUnit.KILOMETERS)         <3>
    .optimizeBbox("memory")                         <4>
    .geoDistance(GeoDistance.ARC);                  <5>

--------------------------------------------------
<1> field
<2> center point
<3> distance from center point
<4> optimize bounding box: `memory`, `indexed` or `none`
<5> distance computation mode: `GeoDistance.SLOPPY_ARC` (default), `GeoDistance.ARC` (slightly more precise but
    significantly slower) or `GeoDistance.PLANE` (faster, but inaccurate on long distances and close to the poles)

