Prompt
how to index embeddings in qdrant with filters
Latest observation
Oct 17, 2026
OpenAI APIWeb search: off
In Qdrant, you usually don’t index embeddings “with filters” directly in the vector index. Instead:
- Vectors are indexed for similarity search.
- Payload fields are indexed separately so Qdrant can filter candidate points efficiently before/during vector search.
Typical setup
1) Store vectors + payload
Each point has:
- an
id - a vector embedding
- metadata/payload fields you want to filter on
Example payload:
{
"tenant_id": "acme",
"category": "invoice",
"created_at": 1720000000,
"tags": ["finance", "pdf"]
}
2) Create payload indexes on filterable fields
If you want fast filtering, create payload indexes for fields you’ll query often.
Python
from qdrant_client import QdrantClient
from qdrant_client.http import models
client = QdrantClient(host="localhost", port=6333)
client.create_payload_index(
collection_name="my_collection",
field_name="tenant_id",
field_schema=models.PayloadSchemaType.KEYWORD,
)
client.create_payload_index(
collection_name="my_collection",
field_name="category",
field_schema=models.PayloadSchemaType.KEYWORD,
)
client.create_payload_index(
collection_name="my_collection",
field_name="created_at",
field_schema=models.PayloadSchemaType.INTEGER,
)
Common field types:
KEYWORDfor exact match stringsINTEGER/FLOATBOOLDATETIMEGEOTEXT(for text indexing / full-text search, if enabled)
3) Query with a filter + vector
You then pass the filter when searching:
Python example
results = client.search(
collection_name="my_collection",
query_vector=[0.1, 0.2, 0.3, 0.4],
limit=10,
query_filter=models.Filter(
must=[
models.FieldCondition(
key="tenant_id",
match=models.MatchValue(value="acme")
),
models.FieldCondition(
key="category",
match=models.MatchValue(value="invoice")
),
]
)
)
Filter examples
Exact match
models.FieldCondition(
key="tenant_id",
match=models.MatchValue(value="acme")
)
Range
models.FieldCondition(
key="created_at",
range=models.Range(gte=1720000000, lt=1730000000)
)
List contains
models.FieldCondition(
key="tags",
match=models.MatchValue(value="finance")
)
How Qdrant uses the indexes
- The vector index finds nearest embeddings.
- The payload index helps narrow down points matching filters.
- Qdrant may:
- filter first, then search within matching points
- or search and then apply filtering, depending on the query and index structure
For selective filters, payload indexes can make a big difference.
Important notes
You cannot make the vector index itself “filter-aware”
Instead, use:
- payload indexing for metadata
- filter clauses in search/query requests
Use named vectors if needed
If you store multiple embeddings per point, define named vectors in the collection and search the one you want.
For best performance
- Index fields you filter on frequently
- Prefer low-cardinality exact-match filters for payload indexes
- Avoid indexing every field if not needed
Example collection creation
client.create_collection(
collection_name="my_collection",
vectors_config=models.VectorParams(
size=384,
distance=models.Distance.COSINE
)
)
Then insert points with payload:
client.upsert(
collection_name="my_collection",
points=[
models.PointStruct(
id=1,
vector=[0.1]*384,
payload={"tenant_id": "acme", "category": "invoice"}
)
]
)
If you want, I can also give you:
- a full Python example end-to-end, or
- the equivalent REST API example, or
- advice on which payload fields should be indexed for your schema.
Brands