geo-distance-range-query.asciidoc 1.3 KB

1234567891011121314151617181920212223242526
  1. [[java-query-dsl-geo-distance-range-query]]
  2. ==== Geo Distance Range Query
  3. See {ref}/query-dsl-geo-distance-range-query.html[Geo Distance Range Query]
  4. [source,java]
  5. --------------------------------------------------
  6. QueryBuilder qb = geoDistanceRangeQuery("pin.location", <1>
  7. new GeoPoint(40, -70)) <2>
  8. .from("200km") <3>
  9. .to("400km") <4>
  10. .includeLower(true) <5>
  11. .includeUpper(false) <6>
  12. .optimizeBbox("memory") <7>
  13. .geoDistance(GeoDistance.ARC); <8>
  14. --------------------------------------------------
  15. <1> field
  16. <2> center point
  17. <3> starting distance from center point
  18. <4> ending distance from center point
  19. <5> include lower value means that `from` is `gt` when `false` or `gte` when `true`
  20. <6> include upper value means that `to` is `lt` when `false` or `lte` when `true`
  21. <7> optimize bounding box: `memory`, `indexed` or `none`
  22. <8> distance computation mode: `GeoDistance.SLOPPY_ARC` (default), `GeoDistance.ARC` (slightly more precise but
  23. significantly slower) or `GeoDistance.PLANE` (faster, but inaccurate on long distances and close to the poles)