TigerData's beginner guide defines an embedding as a compact representation of raw data, such as an image or text, transformed into a vector comprising floating-point numbers. An embedding model is trained so that semantically similar items end up close together in that vector space. "How do I reset my password" and "I forgot my login" share almost no words, but a good model places them near each other.
Vector search uses that property. Elastic's explainer describes the contrast: traditional search relies on keywords, lexical similarity and word frequency, while vector search engines use distances in the embedding space to represent similarity. Finding related content becomes finding the nearest neighbors of the query vector. Both the documents and the query must be embedded the same way for the distances to mean anything.
Three distance measures are common.
| Measure | What it compares | When to use it |
|---|---|---|
| Cosine distance | The angle between vectors | The default for most text embedding models |
| Inner product | Angle and length together | Models whose vectors are normalized to length 1, where it matches cosine and is cheaper |
| L2 (Euclidean) distance | Straight-line distance | Models documented for it, and many image models |
Use the measure the embedding model's documentation recommends. A mismatched distance function quietly lowers result quality.



