From Words to Meaning: The Rise of Vector Search in Cosmos DB

Modern search is shifting from looking at words to understanding meaning. Traditional indexing and search have worked well for decades, but they were designed for documents and keywords, not natural language. When users ask questions, paraphrase content, or mix languages, old search models struggle.
With Cosmos DB Vector Search, Microsoft brings semantic understanding directly into the database. Instead of matching words, it measures similarity of meaning. This article explains how traditional word-based search works, why it often fails for natural language, and how vector search changes the game.
Introduction
Traditional search engines depend on rules. They split text into words, remove noise, and match tokens. It’s efficient, but mechanical.
Cosmos DB’s Vector Search for NoSQL API introduces a completely different approach. It represents content as vectors, arrays of numbers that capture the semantic context of words, sentences, or entire documents. Similar meanings are stored close to each other in multidimensional space.
This article compares these two approaches and explains why vector-based similarity search is better suited for natural language and AI-powered applications.
How Traditional Search Works
Before understanding why vector search matters, it helps to know how traditional search functions.
Most search engines use inverted indexes. They break text into tokens, often using word breakers and analyzers. Each unique word points to a list of documents that contain it. To improve accuracy, search systems also use stemmers and lemmatizers that reduce words to their root forms.
- “driving”, “driven”, and “driver” are reduced to “drive”
- “cats” and “catlike” both relate to “cat”
When you search for “renew car insurance”, the engine looks up “renew”, “car”, and “insurance” in the index. It might find “renew car insurance policy” but miss “automobile coverage renewal”. The reason is simple, the system compares words, not meanings.
Traditional systems work well for structured or predictable text, such as product names, SKUs, or codes. But they fail when wording changes or when people use synonyms.
Where Keyword Search Falls Short
Word-based indexing is fragile. It relies on exact matches and does not understand context.
- “How to reset password” vs. “forgot login credentials”
- “car insurance” vs. “automobile coverage”
- “apple” as a fruit vs. “Apple” as a company
A word-based system cannot tell that these phrases are semantically close. Even with advanced analyzers, it still matches on form, not intent.
In multilingual contexts, the problem grows. A Finnish query like “vaihda salasana” would never match an English document titled “reset password instructions” without translation or manual mapping.
This is where similarity search provides a better model.
Understanding Vector Search
Instead of storing words, vector search stores vector embeddings. These are fixed-length numeric arrays that represent the meaning of text.
Each vector is a list of floating-point numbers. The distance between two vectors shows how similar their meanings are. Closer vectors mean more similar content.
You can think of a vector as a path through a landscape of meanings. Each point along the path represents a topic or concept found in the text. If another path runs close to it or even crosses it, then the content that the second path represents is likely similar to the first. This is what similarity search looks for, paths that travel close together in meaning.
For example, vectors generated from “how to reset password” and “forgot login credentials” will be close together in vector space, even though they share no words.
Embeddings are created using AI models such as text-embedding-3-small or text-embedding-3-large. These models turn text into a mathematical representation of its meaning.
Once stored, these embeddings make it possible to run similarity searches that find items with vectors close to a given query vector.
How Cosmos DB Vector Search Works
Cosmos DB now supports storing and searching vector embeddings directly inside your NoSQL containers. The feature is available under the Vector Search for NoSQL API.
You enable it by defining a vector policy when creating a container. The policy specifies:
- The JSON path to the embedding array
- The data type (usually
float) - The number of dimensions (for example, 1536 for
text-embedding-3-small) - The distance function to use (typically cosine similarity)
After embeddings are stored, you can use the built-in VectorDistance() function in SQL queries to find semantically similar documents.
SELECT TOP 5 c.id, c.content, VectorDistance(c.embedding.vector, @queryVector) AS similarity FROM c WHERE c.partition = 'help-articles' ORDER BY VectorDistance(c.embedding.vector, @queryVector)
This query returns the five most similar documents to the query vector. You can combine similarity search with metadata filters such as customer ID or region, just like any other Cosmos DB query.
You can find a step-by-step walkthrough of how to enable and configure this feature in my earlier article Cosmos DB Vector Search – An Introduction.
This makes it easy to mix semantic ranking with structured filtering in the same data store.
Why Vector Search Fits Natural Language
Vector embeddings capture the meaning of language rather than its exact form. This makes them ideal for unstructured, user-generated, or multilingual data.
- Semantic understanding: Matches content with similar intent, even with no shared words.
- Synonym and paraphrase tolerance: Recognizes “cancel booking” and “terminate reservation” as related.
- Language agnostic behavior: Similarity depends on meaning, not language.
- Contextual clustering: Similar documents naturally group together, simplifying recommendations and content discovery.
- Support for exploratory search: Vector embeddings help you find information even when you are not sure what you are looking for. They surface related concepts and content that might not contain the words you use but still carry the same meaning.
This semantic flexibility makes vector search a perfect fit for AI-driven scenarios such as:
- RAG (Retrieval-Augmented Generation) pipelines
- Chatbots and virtual assistants
- Knowledge bases and document search
- Product and content recommendations
When to Use Keyword Search and When to Use Vector Search
Keyword and vector search complement each other.
| Use Keyword Search | Use Vector Search |
|---|---|
| When you need exact matches or codes | When queries are phrased naturally |
| When data is structured and predictable | When language is varied or unstructured |
| For short or technical terms | For synonyms, paraphrases, and long-form text |
| For strict filters and sorting | For finding semantically similar documents |
You can also combine both approaches. A hybrid search first narrows down documents with keywords or metadata, then re-ranks the results using vector similarity. This gives the accuracy of filtering with the intelligence of semantic matching.
Building a Simple Similarity Search Flow
- Generate embeddings for your text using Azure AI Foundry.
- Store documents and their embeddings in a Cosmos DB container with a vector policy.
- When a user submits a query, generate a query vector using the same embedding model.
- Run a Cosmos DB SQL query with
VectorDistance()to find the most similar documents. - Optionally combine with structured filters or use the results in a downstream AI model.
This simple flow powers applications that need fast, semantically aware search without moving data to a separate vector database.
Common Questions and Answers
Why not just use full-text search?
Full-text search matches exact words or phrases. It is fast and works well for technical or structured text. However, it fails to capture meaning. Vector search complements it by handling natural language and synonyms.
Do I need a separate AI service to create vectors?
Yes, you need an embedding model such as text-embedding-3-large deployed in Azure AI Foundry. The model transforms text into a numeric vector that you then store in Cosmos DB.
Can vector search handle multiple languages?
Yes. Vector search can be language agnostic because embedding models capture the semantic meaning of text, not the literal words or language used.
Should I replace all keyword searches with vector search?
No. Use keyword search for identifiers or precise filters. Use vector search for meaning-based retrieval or conversational AI. They work best together.
Summary
Traditional search engines match words. Vector search matches meaning.
By storing and querying embeddings directly in Cosmos DB, developers can build applications that understand language, not just text. The same system can now support both structured and semantic queries, making Cosmos DB a powerful choice for AI-driven solutions.
Cosmos DB Vector Search lets you move from searching by words to searching by intent. It is a small change in how data is stored, but a big step toward systems that understand human language.
0 Comments