Vector Search — Azure DocumentDB (cosmosSearch)
Azure DocumentDB's native vector index type is cosmosSearch. Pick the sub-type by scale:
| Index sub-type | Scale sweet spot | Tier |
|---|---|---|
vector-diskann (recommended) |
Up to 500k+ vectors | M30+ |
vector-hnsw |
Up to ~50k vectors | M30+ |
vector-ivf |
Under ~10k vectors | M10+ |
Similarity options: COS (cosine), L2 (Euclidean), IP (inner product).
Rules
- vector-choose-index-type — Prefer DiskANN for production; use HNSW up to 50k, IVF under 10k.
- vector-create-diskann-index — Create a
vector-diskannindex with correctdimensions,similarity,maxDegree, andlBuild. - vector-knn-query — Query with
$search+cosmosSearch; tunelSearchandk; combine with pre-filters. - vector-product-quantization — Shrink high-dimensional vectors (up to 16,000 dims) while preserving recall.
- vector-half-precision — Halve vector memory with fp16 indexing and minimal recall loss.
- vector-normalize-embeddings — Normalize embeddings when using cosine similarity; store model + dimensions alongside vectors.