ElasticGraph Query API: Geographic Filtering
Try these example queries by visiting the GraphiQL UI after booting locally.
Copied!
$ curl -s https://block.github.io/elasticgraph/dc.yml | docker compose -f - up --pull always
The GeoLocation
type supports a special predicate:
near
- Matches records where the field’s geographic location is within a specified distance
from the location identified by
latitude
andlongitude
.When
null
or an empty object is passed, matches all documents.
Here’s an example of this predicate:
Copied!
query FindAsianVenues {
venues(filter: {
location: {near: {
latitude: 49.102271
longitude: 87.143660
maxDistance: 2000
unit: MILE
}}
}) {
nodes {
name
capacity
}
}
}