Rebuild
Endee supports rebuilding a collection’s HNSW index graphs to apply new build parameters or recover from index degradation. Use it to tune recall and memory trade-offs, or to restore a clean graph after heavy upsert/delete churn, without recreating the collection or re-upserting your data.
When to Rebuild
- You want better recall and are willing to trade more memory or build time (increase
Moref_con). - You want faster search with lower memory and can accept slightly lower recall (decrease
M). - The index has degraded after heavy upsert/delete churn and you want a fresh graph.
Starting a Rebuild
Pass a list of field specs, one per field you want to rebuild. Both vector and multi_vector fields are supported. Any sparse field in the list is silently skipped server-side.
rebuild() returns immediately with an initial status body; the actual rebuild runs in the background.
Python
collection = client.get_collection("my_collection")
# Rebuild a single dense field with new HNSW params.
res = collection.rebuild([
{"field": "embedding", "M": 20, "ef_con": 200},
])
# {"fields_total": 1, "total_objects": <n>, "status": "in_progress"}Field spec keys:
| Key | Python | TypeScript | Description |
|---|---|---|---|
field | "field" | field | Field name (required) |
M | "M" | m | HNSW graph connectivity |
ef_con | "ef_con" | efCon | HNSW build-time quality |
Rebuilding Multiple Fields
You can rebuild several dense fields in a single call. The server processes them sequentially and rebuild_status() reports which field is currently being rebuilt.
Python
collection.rebuild([
{"field": "embedding", "M": 20, "ef_con": 200},
{"field": "colbert", "M": 12, "ef_con": 120},
])
# {"fields_total": 2, "total_objects": <n>, "status": "in_progress"}Sparse fields included in the list are silently skipped server-side. You don’t need to filter them out before calling rebuild().
Polling Progress
Call rebuild_status() / rebuildStatus() to check progress. Poll until status is no longer "in_progress".
Python
status = collection.rebuild_status()
# {
# "field": "colbert", # most recently rebuilt field
# "fields_done": 1,
# "fields_total": 2,
# "objects_processed": 500,
# "total_objects": 500,
# "percent_complete": 50.0,
# "status": "in_progress",
# "new_config": {"M": 12, "ef_con": 120},
# "previous_config": {"M": 16, "ef_con": 128},
# "started_at": ...,
# "completed_at": null
# }Status values:
status | Meaning |
|---|---|
in_progress | Rebuild is running |
completed | All requested fields rebuilt successfully |
failed | Rebuild failed |
idle | No rebuild is currently running |
When status is "completed", fields_done equals fields_total and percent_complete is 100.0.
Immutable Parameters
These cannot be changed via rebuild. They are fixed at collection creation time.
| Parameter | How to change |
|---|---|
dimension | Delete and recreate the collection |
space_type | Delete and recreate the collection |
precision | Delete and recreate the collection |
To change any of them, delete the existing collection, create a new one with the desired parameters, and re-upsert your objects. See Collections for collection creation options.