You store 1536-dimension embeddings in Cosmos DB NoSQL and need the 5 nearest neighbours to a query vector. Which query shape is correct?
- A SELECT TOP 5 c.id FROM c ORDER BY VectorDistance(c.embedding, @q) (correct answer)
- B SELECT TOP 5 c.id FROM c WHERE ARRAY_CONTAINS(c.embedding, @q)
- C SELECT TOP 5 c.id FROM c ORDER BY c.embedding
- D SELECT TOP 5 c.id FROM c WHERE ST_DISTANCE(c.embedding, @q) < 1
Shortcut: VectorDistance() computes similarity between a stored vector and a query vector. Combining it with ORDER BY and TOP performs the k-nearest-neighbour search; the container must also have a vector index defined.