Managing Indexes
1. Listing All Indexes
Example: List Indexes
indexes = pc.list_indexes()
for idx in indexes:
print(idx["name"], idx["dimension"], idx["status"]["state"])
# Just names:
names = pc.list_indexes().names()
| Method | Returns |
|---|---|
list_indexes() | IndexList object with full metadata |
.names() | List of index name strings |
Node.js listIndexes() | { indexes: [...] } |
2. Describing Index Configuration
Example: Describe Index
info = pc.describe_index("products")
print(info.host, info.dimension, info.metric, info.spec)
| Field | Description |
|---|---|
name | Index name |
dimension | Vector dim |
metric | Distance metric |
host | API endpoint |
spec | Serverless or pod config |
status | { ready, state } |
deletion_protection | enabled / disabled |
3. Checking Index Statistics
Example: Stats
index = pc.Index("products")
stats = index.describe_index_stats()
print(stats["total_vector_count"], stats["dimension"])
for ns, info in stats["namespaces"].items():
print(ns, info["vector_count"])
| Field | Description |
|---|---|
total_vector_count | Sum across all namespaces |
namespaces | Per-namespace vector counts |
dimension | Vector dim |
index_fullness | 0–1; pod only |
4. Configuring Index Settings
| Setting | Mutable? | API |
|---|---|---|
| replicas | Yes (pod) | configure_index(replicas=N) |
| pod_type | Upgrade only | configure_index(pod_type="p1.x2") |
| deletion_protection | Yes | configure_index(deletion_protection=...) |
| dimension / metric | No | Recreate index |
5. Monitoring Index Status
| State | Meaning |
|---|---|
Initializing | Provisioning; not ready |
ScalingUp | Adding replicas/pods (pod) |
ScalingDown | Removing replicas |
Ready | Accepting traffic |
Terminating | Being deleted |
6. Managing Index Deletion Protection
Example: Disable + Delete
pc.configure_index("products", deletion_protection="disabled")
pc.delete_index("products")
| State | Behavior |
|---|---|
| Enabled | delete_index returns 403 |
| Disabled | Deletion allowed |
7. Deleting Index
Warning: Deletion is permanent and immediate. Always export data first or use a collection backup.
| Step | Action |
|---|---|
| 1 | Backup via collection or external export |
| 2 | Disable deletion protection |
| 3 | pc.delete_index("name") |
8. Handling Index Creation Errors
| Code | Cause |
|---|---|
| 409 | Index name already exists |
| 403 | Quota exceeded or invalid API key |
| 400 | Invalid dim, metric, or spec |
| 503 | Region temporarily unavailable |
9. Estimating Index Capacity Needs
| Variable | Formula |
|---|---|
| Storage (bytes) | vectors × (dim × 4 + metadata_size + 32) |
| Pod count | ceil(total_vectors / pod_capacity) |
| Replicas | ceil(target_QPS / single_pod_QPS) |
10. Understanding Index Limitations
| Limit | Value |
|---|---|
| Max indexes per project | 20 (Standard), higher (Enterprise) |
| Max dim | 20000 |
| Max metadata/vector | 40 KB |
| Max vector ID length | 512 chars |
| Max batch upsert | 2 MB or 1000 vectors |