Skip to main content
The _geoRadius filter returns documents located within a circular area defined by a center point and a radius. This is the most common geo filter, useful for “find nearby” features like store locators, restaurant finders, or service area lookups.

Syntax

_geoRadius(lat, lng, distanceInMeters)
ParameterTypeDescription
latFloatLatitude of the center point
lngFloatLongitude of the center point
distanceInMetersIntegerRadius of the search area in meters
The distance is always expressed in meters. For example, use 2000 for a 2 km radius or 500 for 500 meters.

Filter by radius

The following example searches for restaurants within 2 km of central Milan (latitude 45.472735, longitude 9.184019):
curl \
  -X POST 'MEILISEARCH_URL/indexes/restaurants/search' \
  -H 'Content-type:application/json' \
  --data-binary '{ "filter": "_geoRadius(45.472735, 9.184019, 2000)" }'
Meilisearch returns all documents with a _geo location inside the specified circle:
{
  "hits": [
    {
      "id": 1,
      "name": "Nàpiz' Milano",
      "address": "Viale Vittorio Veneto, 30, 20124, Milan, Italy",
      "type": "pizza",
      "rating": 9,
      "_geo": {
        "lat": 45.4777599,
        "lng": 9.1967508
      },
      "_geoDistance": 1532
    },
    {
      "id": 3,
      "name": "Artico Gelateria Tradizionale",
      "address": "Via Dogana, 1, 20123 Milan, Italy",
      "type": "ice cream",
      "rating": 10,
      "_geo": {
        "lat": 45.4632046,
        "lng": 9.1719421
      },
      "_geoDistance": 1343
    }
  ]
}

Understanding _geoDistance

When you use _geoRadius, Meilisearch automatically includes a _geoDistance field in each result. This value represents the distance in meters between the document’s location and the center point of your radius filter.
_geoDistance is a computed field that only appears in search results. It is not stored in your documents and cannot be used as a filter.

Combine with other filters

You can combine _geoRadius with any other filter using AND and OR operators. The following example finds only pizzerias within 2 km of central Milan:
curl \
  -X POST 'MEILISEARCH_URL/indexes/restaurants/search' \
  -H 'Content-type:application/json' \
  --data-binary '{ "filter": "_geoRadius(45.472735, 9.184019, 2000) AND type = pizza" }'
{
  "hits": [
    {
      "id": 1,
      "name": "Nàpiz' Milano",
      "address": "Viale Vittorio Veneto, 30, 20124, Milan, Italy",
      "type": "pizza",
      "rating": 9,
      "_geo": {
        "lat": 45.4777599,
        "lng": 9.1967508
      },
      "_geoDistance": 1532
    }
  ]
}

Common radius values

Use caseRadius
Walking distance1000 (1 km)
Short drive5000 (5 km)
City-wide15000 (15 km)
Regional50000 (50 km)

Geo search overview

Learn about all geo search capabilities in Meilisearch.

Search API reference

Full reference for the search endpoint and filter parameter.