geo-distance-query.asciidoc 868 B

123456789101112131415161718192021
  1. [[java-query-dsl-geo-distance-query]]
  2. ==== Geo Distance Query
  3. See {ref}/query-dsl-geo-distance-query.html[Geo Distance Query]
  4. [source,java]
  5. --------------------------------------------------
  6. QueryBuilder qb = geoDistanceQuery("pin.location") <1>
  7. .point(40, -70) <2>
  8. .distance(200, DistanceUnit.KILOMETERS) <3>
  9. .optimizeBbox("memory") <4>
  10. .geoDistance(GeoDistance.ARC); <5>
  11. --------------------------------------------------
  12. <1> field
  13. <2> center point
  14. <3> distance from center point
  15. <4> optimize bounding box: `memory`, `indexed` or `none`
  16. <5> distance computation mode: `GeoDistance.SLOPPY_ARC` (default), `GeoDistance.ARC` (slightly more precise but
  17. significantly slower) or `GeoDistance.PLANE` (faster, but inaccurate on long distances and close to the poles)