Geo-Filtered Vector Search
Combine vector similarity with radius, bounding box, and polygon filters in one query, and see why a geo filter needs more than a filter on top of a vector index.
from qdrant_client import QdrantClient, models
results = client.query_points(
collection_name="venues",
query=models.Document(
text="quiet café to work from",
model="sentence-transformers/all-minilm-l6-v2",
),
query_filter=models.Filter(
must=[
models.FieldCondition(
key="location",
geo_radius=models.GeoRadius(
center=models.GeoPoint(
lon=13.403683,
lat=52.520711,
),
radius=1500.0,
),
)
]
),
limit=5,
)
import { QdrantClient } from "@qdrant/js-client-rest";
const results = await client.query("venues", {
query: {
text: "quiet café to work from",
model: "sentence-transformers/all-minilm-l6-v2",
},
filter: {
must: [
{
key: "location",
geo_radius: {
center: {
lon: 13.403683,
lat: 52.520711,
},
radius: 1500.0,
},
},
],
},
limit: 5,
});
use qdrant_client::qdrant::{
Condition, Document, Filter, GeoPoint,
GeoRadius, Query, QueryPointsBuilder,
};
use qdrant_client::Qdrant;
let results = client
.query(
QueryPointsBuilder::new("venues")
.query(Query::new_nearest(Document::new(
"quiet café to work from",
"sentence-transformers/all-minilm-l6-v2",
)))
.filter(Filter::must([Condition::geo_radius(
"location",
GeoRadius {
center: Some(GeoPoint {
lon: 13.403683,
lat: 52.520711,
}),
radius: 1500.0,
},
)]))
.limit(5),
)
.await?;
import static io.qdrant.client.ConditionFactory.geoRadius;
import static io.qdrant.client.QueryFactory.nearest;
import io.qdrant.client.QdrantClient;
import io.qdrant.client.QdrantGrpcClient;
import io.qdrant.client.grpc.Common.Filter;
import io.qdrant.client.grpc.Points.Document;
import io.qdrant.client.grpc.Points.QueryPoints;
var document =
Document.newBuilder()
.setText("quiet café to work from")
.setModel("sentence-transformers/all-minilm-l6-v2")
.build();
var filter =
Filter.newBuilder()
.addMust(
geoRadius(
"location", 52.520711, 13.403683, 1500.0f))
.build();
var results =
client
.queryAsync(
QueryPoints.newBuilder()
.setCollectionName("venues")
.setQuery(nearest(document))
.setFilter(filter)
.setLimit(5)
.build())
.get();
using Qdrant.Client;
using Qdrant.Client.Grpc;
using static Qdrant.Client.Grpc.Conditions;
var results = await client.QueryAsync(
collectionName: "venues",
query: new Document
{
Text = "quiet café to work from",
Model = "sentence-transformers/all-minilm-l6-v2",
},
filter: new Filter
{
Must =
{
GeoRadius(
"location", 52.520711, 13.403683, 1500.0f
),
},
},
limit: 5
);
import (
"context"
"github.com/qdrant/go-client/qdrant"
)
results, err := client.Query(
context.Background(),
&qdrant.QueryPoints{
CollectionName: "venues",
Query: qdrant.NewQueryDocument(&qdrant.Document{
Text: "quiet café to work from",
Model: "sentence-transformers/all-minilm-l6-v2",
}),
Filter: &qdrant.Filter{
Must: []*qdrant.Condition{
qdrant.NewGeoRadius(
"location", 52.520711, 13.403683, 1500.0,
),
},
},
Limit: qdrant.PtrOf(uint64(5)),
},
)
POST /collections/venues/points/query
{
"query": {
"text": "quiet café to work from",
"model": "sentence-transformers/all-minilm-l6-v2"
},
"filter": {
"must": [
{
"key": "location",
"geo_radius": {
"center": { "lon": 13.403683, "lat": 52.520711 },
"radius": 1500.0
}
}
]
},
"limit": 5
}
Two Kinds of “Near” in One Query
Every venue has a place on the map and a place in embedding space, and the two are unrelated. Drag the circle on the map to see how many of the true 10 best matches each approach finds. Select an approach to see its results.

A simplified simulation with sample data that runs in your browser. It shows how each approach behaves, not benchmark numbers.
Why a Geo Filter Is Not Just a Filter
Vector indexes are built to find neighbors in meaning. Location is a second, independent space, and its density varies widely.
Filtering in Vector Search (article)Near on the Map Is Not Near in Meaning
Of the 10 best matches for “quiet café to work from” across the whole city, only 1 is within 1.5 km of central Berlin. If you search first and filter afterward, most of the results disappear.
The Same Radius Is a Different Filter Every Time
In the demo, a 1 km circle in the city center holds 37 venues, and the same circle in Spandau holds 1. A geo filter can match a handful of points or most of the dataset, so no single fixed strategy works for both.
Filters Cut the Search Graph Into Islands
HNSW finds neighbors by walking a graph. Keep only the 70 venues within 1.5 km of the city center and the demo’s graph splits into 48 disconnected pieces, so the walk stops before it reaches the real best matches.
One query, two spaces. A geo-aware index has to handle meaning and location together, so you never trade accuracy for a smaller search area.
Extra Links Inside Each Area
A strict filter can leave the search graph in disconnected pieces, so a filtered search misses good matches. To prevent this, Qdrant adds extra links to the graph, and a geo index does the same.
What Qdrant does. When it builds the index, Qdrant adds links between venues that are close on the map, for each indexed payload field.
What it means. A geo filter no longer leaves islands, so the search walk reaches the real best matches. The geo index has to exist before you ingest data, or Qdrant cannot add the links.
Create the Collection and the Geo Index
This tutorial uses Cloud Inference to create the embeddings, so it runs against a Qdrant Cloud cluster. Refer to the Cloud Quickstart to create one. First, create a collection for the venues. The vector size of 384 matches the embedding model.
from qdrant_client import QdrantClient, models
client.create_collection(
collection_name="venues",
vectors_config=models.VectorParams(size=384, distance=models.Distance.COSINE),
)
import { QdrantClient } from "@qdrant/js-client-rest";
await client.createCollection("venues", {
vectors: { size: 384, distance: "Cosine" },
});
use qdrant_client::qdrant::{CreateCollectionBuilder, Distance, VectorParamsBuilder};
use qdrant_client::Qdrant;
client
.create_collection(
CreateCollectionBuilder::new("venues")
.vectors_config(VectorParamsBuilder::new(384, Distance::Cosine)),
)
.await?;
import io.qdrant.client.QdrantClient;
import io.qdrant.client.QdrantGrpcClient;
import io.qdrant.client.grpc.Collections.Distance;
import io.qdrant.client.grpc.Collections.VectorParams;
client.createCollectionAsync("venues",
VectorParams.newBuilder().setDistance(Distance.Cosine).setSize(384).build()).get();
using Qdrant.Client;
using Qdrant.Client.Grpc;
await client.CreateCollectionAsync(
collectionName: "venues",
vectorsConfig: new VectorParams { Size = 384, Distance = Distance.Cosine }
);
import (
"context"
"github.com/qdrant/go-client/qdrant"
)
client.CreateCollection(context.Background(), &qdrant.CreateCollection{
CollectionName: "venues",
VectorsConfig: qdrant.NewVectorsConfig(&qdrant.VectorParams{
Size: 384,
Distance: qdrant.Distance_Cosine,
}),
})
PUT /collections/venues
{
"vectors": {
"size": 384,
"distance": "Cosine"
}
}
Then create a geo payload index on the location field, right after you create the collection and before you upload points. Qdrant can then build the vector index with geo-aware links from the start.
from qdrant_client import QdrantClient, models
client.create_payload_index(
collection_name="venues",
field_name="location",
field_schema=models.PayloadSchemaType.GEO,
)
import { QdrantClient } from "@qdrant/js-client-rest";
await client.createPayloadIndex("venues", {
field_name: "location",
field_schema: "geo",
});
use qdrant_client::qdrant::{CreateFieldIndexCollectionBuilder, FieldType};
use qdrant_client::Qdrant;
client
.create_field_index(CreateFieldIndexCollectionBuilder::new(
"venues",
"location",
FieldType::Geo,
))
.await?;
import io.qdrant.client.QdrantClient;
import io.qdrant.client.QdrantGrpcClient;
import io.qdrant.client.grpc.Collections.PayloadSchemaType;
client
.createPayloadIndexAsync("venues", "location", PayloadSchemaType.Geo, null, null, null, null)
.get();
using Qdrant.Client;
using Qdrant.Client.Grpc;
await client.CreatePayloadIndexAsync(
collectionName: "venues",
fieldName: "location",
schemaType: PayloadSchemaType.Geo
);
import (
"context"
"github.com/qdrant/go-client/qdrant"
)
client.CreateFieldIndex(context.Background(), &qdrant.CreateFieldIndexCollection{
CollectionName: "venues",
FieldName: "location",
FieldType: qdrant.FieldType_FieldTypeGeo.Enum(),
})
PUT /collections/venues/index
{
"field_name": "location",
"field_schema": "geo"
}
Upload Venues With Locations
Upload ten sample venues. Each venue is a point with a name, a description, and a location object with lat and lon in decimal degrees. Cloud Inference creates the vector from the description, so you pass the text and the model name instead of a vector.
from qdrant_client import QdrantClient, models
# name, description, latitude, longitude
venues = [
("Kaffeehaus Linden", "Quiet café with long tables and free Wi-Fi", 52.5236, 13.3989),
("Roastery 12", "Specialty roastery with a calm back room", 52.5189, 13.4102),
("Spree Books & Coffee", "Bookstore café with armchairs and tea", 52.5254, 13.4113),
("Atelier Coworking", "Coworking space with silent rooms", 52.5298, 13.3984),
("Ramen Ichi", "Small ramen bar with counter seating", 52.5222, 13.392),
("Club Nachtschicht", "Loud techno club open until sunrise", 52.516, 13.4185),
("Skyline Bar", "Rooftop bar with cocktails and live DJs", 52.5232, 13.416),
("Kreuzberg Corner Café", "Cozy café with strong espresso and cake", 52.4985, 13.403),
("Café Tempelhof", "Spacious café, quiet in the mornings", 52.473, 13.4034),
("Charlottenburg Tea House", "Calm tea house with a garden terrace", 52.516, 13.304),
]
client.upsert(
collection_name="venues",
points=[
models.PointStruct(
id=i,
vector=models.Document(text=description, model="sentence-transformers/all-minilm-l6-v2"),
payload={
"name": name,
"description": description,
"location": {"lat": lat, "lon": lon},
},
)
for i, (name, description, lat, lon) in enumerate(venues)
],
)
import { QdrantClient } from "@qdrant/js-client-rest";
const venues = [
{ name: "Kaffeehaus Linden", description: "Quiet café with long tables and free Wi-Fi", lat: 52.5236, lon: 13.3989 },
{ name: "Roastery 12", description: "Specialty roastery with a calm back room", lat: 52.5189, lon: 13.4102 },
{ name: "Spree Books & Coffee", description: "Bookstore café with armchairs and tea", lat: 52.5254, lon: 13.4113 },
{ name: "Atelier Coworking", description: "Coworking space with silent rooms", lat: 52.5298, lon: 13.3984 },
{ name: "Ramen Ichi", description: "Small ramen bar with counter seating", lat: 52.5222, lon: 13.392 },
{ name: "Club Nachtschicht", description: "Loud techno club open until sunrise", lat: 52.516, lon: 13.4185 },
{ name: "Skyline Bar", description: "Rooftop bar with cocktails and live DJs", lat: 52.5232, lon: 13.416 },
{ name: "Kreuzberg Corner Café", description: "Cozy café with strong espresso and cake", lat: 52.4985, lon: 13.403 },
{ name: "Café Tempelhof", description: "Spacious café, quiet in the mornings", lat: 52.473, lon: 13.4034 },
{ name: "Charlottenburg Tea House", description: "Calm tea house with a garden terrace", lat: 52.516, lon: 13.304 },
];
await client.upsert("venues", {
wait: true,
points: venues.map((venue, i) => ({
id: i,
vector: { text: venue.description, model: "sentence-transformers/all-minilm-l6-v2" },
payload: {
name: venue.name,
description: venue.description,
location: { lat: venue.lat, lon: venue.lon },
},
})),
});
use qdrant_client::qdrant::{Document, PointStruct, UpsertPointsBuilder};
use qdrant_client::{Payload, Qdrant};
use serde_json::json;
let venues = [
("Kaffeehaus Linden", "Quiet café with long tables and free Wi-Fi", 52.5236, 13.3989),
("Roastery 12", "Specialty roastery with a calm back room", 52.5189, 13.4102),
("Spree Books & Coffee", "Bookstore café with armchairs and tea", 52.5254, 13.4113),
("Atelier Coworking", "Coworking space with silent rooms", 52.5298, 13.3984),
("Ramen Ichi", "Small ramen bar with counter seating", 52.5222, 13.392),
("Club Nachtschicht", "Loud techno club open until sunrise", 52.516, 13.4185),
("Skyline Bar", "Rooftop bar with cocktails and live DJs", 52.5232, 13.416),
("Kreuzberg Corner Café", "Cozy café with strong espresso and cake", 52.4985, 13.403),
("Café Tempelhof", "Spacious café, quiet in the mornings", 52.473, 13.4034),
("Charlottenburg Tea House", "Calm tea house with a garden terrace", 52.516, 13.304),
];
let mut points = Vec::new();
for (i, (name, description, lat, lon)) in venues.into_iter().enumerate() {
points.push(PointStruct::new(
i as u64,
Document::new(description, "sentence-transformers/all-minilm-l6-v2"),
Payload::try_from(json!({
"name": name,
"description": description,
"location": { "lat": lat, "lon": lon },
}))?,
));
}
client
.upsert_points(UpsertPointsBuilder::new("venues", points).wait(true))
.await?;
import static io.qdrant.client.PointIdFactory.id;
import static io.qdrant.client.ValueFactory.value;
import static io.qdrant.client.VectorsFactory.vectors;
import io.qdrant.client.QdrantClient;
import io.qdrant.client.QdrantGrpcClient;
import io.qdrant.client.grpc.Points.Document;
import io.qdrant.client.grpc.Points.PointStruct;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
// name, description, latitude, longitude
String[][] venues = {
{"Kaffeehaus Linden", "Quiet café with long tables and free Wi-Fi", "52.5236", "13.3989"},
{"Roastery 12", "Specialty roastery with a calm back room", "52.5189", "13.4102"},
{"Spree Books & Coffee", "Bookstore café with armchairs and tea", "52.5254", "13.4113"},
{"Atelier Coworking", "Coworking space with silent rooms", "52.5298", "13.3984"},
{"Ramen Ichi", "Small ramen bar with counter seating", "52.5222", "13.392"},
{"Club Nachtschicht", "Loud techno club open until sunrise", "52.516", "13.4185"},
{"Skyline Bar", "Rooftop bar with cocktails and live DJs", "52.5232", "13.416"},
{"Kreuzberg Corner Café", "Cozy café with strong espresso and cake", "52.4985", "13.403"},
{"Café Tempelhof", "Spacious café, quiet in the mornings", "52.473", "13.4034"},
{"Charlottenburg Tea House", "Calm tea house with a garden terrace", "52.516", "13.304"},
};
List<PointStruct> points = new ArrayList<>();
for (int i = 0; i < venues.length; i++) {
points.add(
PointStruct.newBuilder()
.setId(id(i))
.setVectors(vectors(
Document.newBuilder()
.setText(venues[i][1])
.setModel("sentence-transformers/all-minilm-l6-v2")
.build()))
.putAllPayload(Map.of(
"name", value(venues[i][0]),
"description", value(venues[i][1]),
"location", value(Map.of(
"lat", value(Double.parseDouble(venues[i][2])),
"lon", value(Double.parseDouble(venues[i][3]))))))
.build());
}
client.upsertAsync("venues", points).get();
using Qdrant.Client;
using Qdrant.Client.Grpc;
var venues = new[]
{
("Kaffeehaus Linden", "Quiet café with long tables and free Wi-Fi", 52.5236, 13.3989),
("Roastery 12", "Specialty roastery with a calm back room", 52.5189, 13.4102),
("Spree Books & Coffee", "Bookstore café with armchairs and tea", 52.5254, 13.4113),
("Atelier Coworking", "Coworking space with silent rooms", 52.5298, 13.3984),
("Ramen Ichi", "Small ramen bar with counter seating", 52.5222, 13.392),
("Club Nachtschicht", "Loud techno club open until sunrise", 52.516, 13.4185),
("Skyline Bar", "Rooftop bar with cocktails and live DJs", 52.5232, 13.416),
("Kreuzberg Corner Café", "Cozy café with strong espresso and cake", 52.4985, 13.403),
("Café Tempelhof", "Spacious café, quiet in the mornings", 52.473, 13.4034),
("Charlottenburg Tea House", "Calm tea house with a garden terrace", 52.516, 13.304),
};
var points = new List<PointStruct>();
for (int i = 0; i < venues.Length; i++)
{
var venue = venues[i];
points.Add(new PointStruct
{
Id = (ulong)i,
Vectors = new Document
{
Text = venue.Item2,
Model = "sentence-transformers/all-minilm-l6-v2",
},
Payload =
{
["name"] = venue.Item1,
["description"] = venue.Item2,
["location"] = new Dictionary<string, Value>
{
["lat"] = venue.Item3,
["lon"] = venue.Item4,
},
},
});
}
await client.UpsertAsync("venues", points);
import (
"context"
"github.com/qdrant/go-client/qdrant"
)
type Venue struct {
Name, Description string
Lat, Lon float64
}
venues := []Venue{
{"Kaffeehaus Linden", "Quiet café with long tables and free Wi-Fi", 52.5236, 13.3989},
{"Roastery 12", "Specialty roastery with a calm back room", 52.5189, 13.4102},
{"Spree Books & Coffee", "Bookstore café with armchairs and tea", 52.5254, 13.4113},
{"Atelier Coworking", "Coworking space with silent rooms", 52.5298, 13.3984},
{"Ramen Ichi", "Small ramen bar with counter seating", 52.5222, 13.392},
{"Club Nachtschicht", "Loud techno club open until sunrise", 52.516, 13.4185},
{"Skyline Bar", "Rooftop bar with cocktails and live DJs", 52.5232, 13.416},
{"Kreuzberg Corner Café", "Cozy café with strong espresso and cake", 52.4985, 13.403},
{"Café Tempelhof", "Spacious café, quiet in the mornings", 52.473, 13.4034},
{"Charlottenburg Tea House", "Calm tea house with a garden terrace", 52.516, 13.304},
}
points := make([]*qdrant.PointStruct, len(venues))
for i, venue := range venues {
points[i] = &qdrant.PointStruct{
Id: qdrant.NewIDNum(uint64(i)),
Vectors: qdrant.NewVectorsDocument(&qdrant.Document{
Text: venue.Description,
Model: "sentence-transformers/all-minilm-l6-v2",
}),
Payload: qdrant.NewValueMap(map[string]any{
"name": venue.Name,
"description": venue.Description,
"location": map[string]any{"lat": venue.Lat, "lon": venue.Lon},
}),
}
}
client.Upsert(context.Background(), &qdrant.UpsertPoints{
CollectionName: "venues",
Points: points,
})
PUT /collections/venues/points?wait=true
{
"points": [
{
"id": 0,
"vector": {
"text": "Quiet café with long tables and free Wi-Fi",
"model": "sentence-transformers/all-minilm-l6-v2"
},
"payload": {
"name": "Kaffeehaus Linden",
"description": "Quiet café with long tables and free Wi-Fi",
"location": { "lat": 52.5236, "lon": 13.3989 }
}
},
{
"id": 1,
"vector": {
"text": "Specialty roastery with a calm back room",
"model": "sentence-transformers/all-minilm-l6-v2"
},
"payload": {
"name": "Roastery 12",
"description": "Specialty roastery with a calm back room",
"location": { "lat": 52.5189, "lon": 13.4102 }
}
},
{
"id": 2,
"vector": {
"text": "Bookstore café with armchairs and tea",
"model": "sentence-transformers/all-minilm-l6-v2"
},
"payload": {
"name": "Spree Books & Coffee",
"description": "Bookstore café with armchairs and tea",
"location": { "lat": 52.5254, "lon": 13.4113 }
}
},
{
"id": 3,
"vector": {
"text": "Coworking space with silent rooms",
"model": "sentence-transformers/all-minilm-l6-v2"
},
"payload": {
"name": "Atelier Coworking",
"description": "Coworking space with silent rooms",
"location": { "lat": 52.5298, "lon": 13.3984 }
}
},
{
"id": 4,
"vector": {
"text": "Small ramen bar with counter seating",
"model": "sentence-transformers/all-minilm-l6-v2"
},
"payload": {
"name": "Ramen Ichi",
"description": "Small ramen bar with counter seating",
"location": { "lat": 52.5222, "lon": 13.392 }
}
},
{
"id": 5,
"vector": {
"text": "Loud techno club open until sunrise",
"model": "sentence-transformers/all-minilm-l6-v2"
},
"payload": {
"name": "Club Nachtschicht",
"description": "Loud techno club open until sunrise",
"location": { "lat": 52.516, "lon": 13.4185 }
}
},
{
"id": 6,
"vector": {
"text": "Rooftop bar with cocktails and live DJs",
"model": "sentence-transformers/all-minilm-l6-v2"
},
"payload": {
"name": "Skyline Bar",
"description": "Rooftop bar with cocktails and live DJs",
"location": { "lat": 52.5232, "lon": 13.416 }
}
},
{
"id": 7,
"vector": {
"text": "Cozy café with strong espresso and cake",
"model": "sentence-transformers/all-minilm-l6-v2"
},
"payload": {
"name": "Kreuzberg Corner Café",
"description": "Cozy café with strong espresso and cake",
"location": { "lat": 52.4985, "lon": 13.403 }
}
},
{
"id": 8,
"vector": {
"text": "Spacious café, quiet in the mornings",
"model": "sentence-transformers/all-minilm-l6-v2"
},
"payload": {
"name": "Café Tempelhof",
"description": "Spacious café, quiet in the mornings",
"location": { "lat": 52.473, "lon": 13.4034 }
}
},
{
"id": 9,
"vector": {
"text": "Calm tea house with a garden terrace",
"model": "sentence-transformers/all-minilm-l6-v2"
},
"payload": {
"name": "Charlottenburg Tea House",
"description": "Calm tea house with a garden terrace",
"location": { "lat": 52.516, "lon": 13.304 }
}
}
]
}
For a venue with several locations, use a list of these objects. The point matches a geo filter when at least one location satisfies the condition.
Choose a Shape
Qdrant lets you filter by different shapes: a radius, a bounding box, or a polygon. Each one is a regular filter condition, so you can combine it with keyword, range, full-text, and other payload conditions in the same request. The cards show each condition as JSON.
Radius
Use it for “within a 15-minute walk of me”. The radius is in meters.
{
"key": "location",
"geo_radius": {
"center": {
"lon": 13.403683,
"lat": 52.520711
},
"radius": 1500.0
}
}
Bounding Box
Use it for whatever is visible on the user’s map right now.
{
"key": "location",
"geo_bounding_box": {
"top_left": {
"lon": 13.37,
"lat": 52.53
},
"bottom_right": {
"lon": 13.44,
"lat": 52.50
}
}
}
Polygon
Use it for delivery zones, districts, or a city minus its airport. Holes are supported.
{
"key": "location",
"geo_polygon": {
"exterior": {
"points": [
{ "lon": 13.37, "lat": 52.53 },
{ "lon": 13.44, "lat": 52.53 },
{ "lon": 13.44, "lat": 52.50 },
{ "lon": 13.37, "lat": 52.50 },
{ "lon": 13.37, "lat": 52.53 }
]
}
}
}
A Plan for Every Query
A geo filter can match a handful of points or most of the dataset, and no single search strategy suits both.
What Qdrant does. The query planner estimates how many points match the filter, using the payload index. With few matches, it checks each one exactly. With many, it walks the graph and applies the filter during the walk.
What it means. You write the same filter either way, from a single block to a whole region. The collection’s full_scan_threshold sets where the planner switches.
Filter by Location
Send meaning and location in one request. The query ranks venues by meaning, and a geo filter keeps only the venues inside a shape.
from qdrant_client import QdrantClient, models
results = client.query_points(
collection_name="venues",
query=models.Document(
text="quiet café to work from",
model="sentence-transformers/all-minilm-l6-v2",
),
query_filter=models.Filter(
must=[
models.FieldCondition(
key="location",
geo_radius=models.GeoRadius(
center=models.GeoPoint(
lon=13.403683,
lat=52.520711,
),
radius=1500.0,
),
)
]
),
limit=5,
)
import { QdrantClient } from "@qdrant/js-client-rest";
const results = await client.query("venues", {
query: {
text: "quiet café to work from",
model: "sentence-transformers/all-minilm-l6-v2",
},
filter: {
must: [
{
key: "location",
geo_radius: {
center: {
lon: 13.403683,
lat: 52.520711,
},
radius: 1500.0,
},
},
],
},
limit: 5,
});
use qdrant_client::qdrant::{
Condition, Document, Filter, GeoPoint,
GeoRadius, Query, QueryPointsBuilder,
};
use qdrant_client::Qdrant;
let results = client
.query(
QueryPointsBuilder::new("venues")
.query(Query::new_nearest(Document::new(
"quiet café to work from",
"sentence-transformers/all-minilm-l6-v2",
)))
.filter(Filter::must([Condition::geo_radius(
"location",
GeoRadius {
center: Some(GeoPoint {
lon: 13.403683,
lat: 52.520711,
}),
radius: 1500.0,
},
)]))
.limit(5),
)
.await?;
import static io.qdrant.client.ConditionFactory.geoRadius;
import static io.qdrant.client.QueryFactory.nearest;
import io.qdrant.client.QdrantClient;
import io.qdrant.client.QdrantGrpcClient;
import io.qdrant.client.grpc.Common.Filter;
import io.qdrant.client.grpc.Points.Document;
import io.qdrant.client.grpc.Points.QueryPoints;
var document =
Document.newBuilder()
.setText("quiet café to work from")
.setModel("sentence-transformers/all-minilm-l6-v2")
.build();
var filter =
Filter.newBuilder()
.addMust(
geoRadius(
"location", 52.520711, 13.403683, 1500.0f))
.build();
var results =
client
.queryAsync(
QueryPoints.newBuilder()
.setCollectionName("venues")
.setQuery(nearest(document))
.setFilter(filter)
.setLimit(5)
.build())
.get();
using Qdrant.Client;
using Qdrant.Client.Grpc;
using static Qdrant.Client.Grpc.Conditions;
var results = await client.QueryAsync(
collectionName: "venues",
query: new Document
{
Text = "quiet café to work from",
Model = "sentence-transformers/all-minilm-l6-v2",
},
filter: new Filter
{
Must =
{
GeoRadius(
"location", 52.520711, 13.403683, 1500.0f
),
},
},
limit: 5
);
import (
"context"
"github.com/qdrant/go-client/qdrant"
)
results, err := client.Query(
context.Background(),
&qdrant.QueryPoints{
CollectionName: "venues",
Query: qdrant.NewQueryDocument(&qdrant.Document{
Text: "quiet café to work from",
Model: "sentence-transformers/all-minilm-l6-v2",
}),
Filter: &qdrant.Filter{
Must: []*qdrant.Condition{
qdrant.NewGeoRadius(
"location", 52.520711, 13.403683, 1500.0,
),
},
},
Limit: qdrant.PtrOf(uint64(5)),
},
)
POST /collections/venues/points/query
{
"query": {
"text": "quiet café to work from",
"model": "sentence-transformers/all-minilm-l6-v2"
},
"filter": {
"must": [
{
"key": "location",
"geo_radius": {
"center": { "lon": 13.403683, "lat": 52.520711 },
"radius": 1500.0
}
}
]
},
"limit": 5
}
The example uses a radius. To filter by a bounding box or a polygon instead, replace the geo_radius condition with a geo_bounding_box or geo_polygon condition, as shown in Choose a Shape.
Tune It if You Need To
The defaults work for most collections. Two HNSW settings matter for geo filters:
full_scan_thresholdsets where the planner switches from graph search to an exact search over the matching points.payload_msets how many extra links the index adds for each payload field.
Refer to Vector Index for both.
Keep Going
The Geo Search docs cover every shape, distance-based ranking, and how to combine filters and formulas.
Geo Search
The reference for geo filters, geo_distance scoring, and combining filtering with ranking. Read the Geo Search docs.
Filtering
Combine a geo condition with must, should, and must_not clauses and conditions on other payload fields. Read the Filtering docs.
How Filtered Search Works
A deeper look at why filters break vector search and how filterable HNSW fixes it. Read the article.