# Vector Search

Vector search retrieves items by comparing numerical representations called vectors and ranking them by similarity to a query vector.

Cloud concept. Updated 2026-10-29. Page: https://blowstack.com/tools/cloud-concepts-hub/vector-search

> Embedding models represent text, images, audio, or other data as vectors whose relative positions can reflect meaningful relationships. Vector search uses these representations to find related content even when exact words differ, supporting semantic retrieval, recommendations, and retrieval-augmented generation.

Practice exams covering Vector Search: [AIF-C01 AWS Certified AI Practitioner](https://blowstack.com/practice-exams/aws-certified-ai-practitioner), [DEA-C01 AWS Certified Data Engineer - Associate](https://blowstack.com/practice-exams/aws-certified-data-engineer-associate), [AIP-C01 AWS Certified Generative AI Developer - Professional](https://blowstack.com/practice-exams/aws-certified-generative-ai-developer-professional), [MLA-C02 (beta) AWS Certified Machine Learning Engineer - Associate](https://blowstack.com/practice-exams/aws-certified-machine-learning-engineer-associate), [SAP-C03 AWS Certified Solutions Architect - Professional](https://blowstack.com/practice-exams/aws-certified-solutions-architect-professional).

## 6 key aspects of Vector Search

Effective vector search combines compatible embeddings, suitable similarity measures, evaluated indexing strategies, authorized retrieval, and disciplined data lifecycle management.

1. **Compatible embedding representations**: Represent content and queries as vectors in a compatible embedding space. Choose a model appropriate for the data and retrieval task, and track its version, dimensions, and configuration.
2. **Similarity measures**: Rank candidates using measures such as cosine similarity, dot product, or Euclidean distance. Follow the embedding model's guidance because normalization and metric choice can change the ranking.
3. **Exact and approximate retrieval**: Exact search preserves the true nearest-neighbor result, whether implemented through exhaustive scanning or an exact index. Approximate indexes can improve latency or resource usage at the cost of potentially missing true neighbors, so measure recall under realistic workloads.
4. **Filtering and hybrid retrieval**: Combine vector similarity with constraints such as tenant, language, product, and document status. Add lexical retrieval when exact terms matter, and verify that filtering preserves authorization and sufficient result coverage.
5. **Foundation-model grounding**: Retrieve relevant passages as external context for RAG instead of placing the entire knowledge base into every prompt. This supports grounded answers but does not eliminate generation errors or replace evaluation.
6. **Index lifecycle and security**: Keep embeddings synchronized with source changes, deletions, and permissions. Plan model migrations and protect vectors, metadata, and retrieved text according to their sensitivity.

## Cloud services for Vector Search

An embedding model, such as one available through Amazon Bedrock, converts source content and queries into compatible vectors. OpenSearch Service provides a search-oriented backend, while Aurora PostgreSQL-Compatible Edition and RDS for PostgreSQL support SQL-based vector storage through pgvector. Neptune Analytics supports retrieval involving graph embeddings and relationships. These services are usually alternative retrieval backends, not components every application must deploy together. An application or supported managed RAG workflow retrieves authorized passages from the selected backend and supplies them to a foundation model. Ingestion processes maintain source freshness, embedding consistency, and deletion handling.

- **[Amazon OpenSearch Service](https://blowstack.com/tools/cloud-services-hub/amazon-opensearch-service)**: Stores and indexes embeddings for vector similarity search and supports combining vector retrieval with lexical search and metadata filters. It is useful when an application needs a search-oriented retrieval layer across multiple content sources.
- **[Amazon Aurora](https://blowstack.com/tools/cloud-services-hub/amazon-aurora)**: Amazon Aurora PostgreSQL-Compatible Edition supports the pgvector extension for storing and searching embeddings with SQL. Applications can combine vector retrieval with relational records and joins; do not assume the same extension support applies to Aurora MySQL-Compatible Edition.
- **[Amazon Neptune](https://blowstack.com/tools/cloud-services-hub/amazon-neptune)**: Within the Neptune family, Amazon Neptune Analytics supports storing embeddings associated with graph vertices and performing vector similarity searches. Applications can combine similarity retrieval with graph relationships; distinguish these capabilities from those of Neptune Database.
- **[Amazon Bedrock](https://blowstack.com/tools/cloud-services-hub/amazon-bedrock)**: Provides access to embedding models and foundation models used around the retrieval pipeline. Amazon Bedrock Knowledge Bases can orchestrate supported RAG workflows with compatible vector stores, but model invocation itself is not a vector database.

## Vector Search exam questions

Real practice exam questions on Vector Search, with the correct answer and its explanation.

### Question 1 (AIF-C01)

**Question:**

A design agency is building an FM-powered application that finds reference images with visual characteristics similar to an uploaded image. An embedding model already generates vectors for both stored images and uploaded images. Usage varies sharply during client campaigns. The agency needs a managed store that indexes the vectors and performs similarity searches, without requiring the team to select database instance types or manage search-cluster node counts. Which solution best meets these requirements?

**Correct answer:** Use an Amazon OpenSearch Serverless vector search collection with a vector index for the image embeddings.

**Explanation:** An OpenSearch Serverless vector search collection can store and index image embeddings for similarity searches. It manages the underlying capacity without requiring the agency to select database instance types or manage search-cluster node counts.

### Question 2 (MLA-C02 (beta))

**Question:**

A company operates a multitenant semantic-search application on Amazon OpenSearch Service. Each indexed passage includes an embedding and a tenantId field. The index uses an approximate k-nearest neighbor (k-NN) engine that supports efficient filtering.

For each user request, the application retrieves the 20 nearest passages across all tenants and then discards passages belonging to other tenants. If fewer than 10 passages remain, the application repeats the search with a larger candidate count. As more tenants join, monitoring shows increasing search calls and CPU consumption per user request, even though request volume is stable. Most discarded results belong to other tenants.

The company must eliminate retries caused by this filtering pattern without increasing the number of globally retrieved candidates. It must preserve semantic retrieval and ensure that only the authenticated tenant's passages are returned.

Which change should an ML engineer make?

**Correct answer:** Include a tenantId filter inside the k-NN query, using the engine's efficient filtering capability to select neighbors from the authenticated tenant's passages.

**Explanation:** Efficient filtering incorporates the tenant restriction into vector retrieval instead of discarding other tenants' results afterward. This addresses the unnecessary search calls caused by post-retrieval filtering while preserving semantic similarity ranking within the eligible tenant's passages.

### Question 3 (SAP-C03)

**Question:**

A SaaS company operates a retrieval-augmented generation (RAG) assistant for 5,000 tenants. A shared Amazon OpenSearch Service index stores document chunks, embeddings, and a tenant_id keyword field. The vector field uses a Lucene HNSW index. The application derives the tenant ID from the authenticated user's identity.

Currently, the application retrieves the 100 nearest vectors across the index and then removes chunks belonging to other tenants. Small tenants frequently receive no context even when they have many relevant chunks. Some large tenants have millions of chunks.

The company requires tenant restrictions to be enforced within OpenSearch before candidate passages are returned to the application. Retrieval should return up to 20 tenant-authorized nearest neighbors when enough matching documents exist, without retrieving thousands of cross-tenant candidates or exhaustively scoring every document belonging to a tenant.

Which solution best meets these requirements?

**Correct answer:** Place a term filter for the authenticated tenant_id inside the k-NN query's filter parameter, and request 20 neighbors. Use Lucene's efficient k-NN filtering to incorporate the restriction into vector retrieval.

**Explanation:** Lucene supports efficient filtering within an OpenSearch k-NN query. Supplying the tenant restriction inside the k-NN filter allows neighbor selection to account for eligibility instead of discarding other tenants' results after global candidate selection. This addresses underfilled results while avoiding application-side oversampling and an exhaustive script-based similarity calculation over every tenant document. OpenSearch may choose its internal search strategy based on filter selectivity.

### Question 4 (DEA-C01)

**Question:**

An engineering company stores project records and technical-document passages in Amazon Aurora PostgreSQL-Compatible Edition. Each passage has a project ID and an embedding generated by the same model used to embed search queries. Engineers must find passages with similar meanings even when the query uses different terminology.

For each request, the application must return the 10 passages with the smallest cosine distances among all passages belonging to the specified project. Audit requirements prohibit approximate results. Each project contains at most 2,000 passages, and testing confirms that calculating distances for every passage in one project meets the latency requirement.

Which storage and query design meets these requirements?

**Correct answer:** Store embeddings in a pgvector vector column. Restrict the query to the specified project, calculate cosine distance for every matching passage, and order by distance with LIMIT 10 without using an approximate nearest-neighbor index.

**Explanation:** Exact distance evaluation over the project's passages returns the required nearest results without approximation. Filtering by project defines the correct candidate set, and the tested project size makes exhaustive distance calculation acceptable.

### Question 5 (AIP-C01)

**Question:**

A company uses Amazon OpenSearch Service for a retrieval-augmented generation assistant that searches 100 million passage embeddings. The company cannot add data nodes. A full-precision, in-memory HNSW index exceeds the available vector-search memory and causes frequent index loading and eviction.

The deployed OpenSearch version supports disk-based Faiss HNSW search with vector compression and rescoring against retained full-precision vectors. A compressed prototype fits the memory budget. Evaluation against exact full-precision nearest neighbors shows the following:

• Returning 20 candidates ranked by compressed-vector similarity achieves 84% recall@20.
• Even exhaustive ranking by compressed-vector similarity achieves only 86% recall@20.
• Retrieving 200 compressed-index candidates and rescoring them with the original vectors achieves 97% recall@20 and 160-ms p95 latency at peak concurrency.
• Exact full-corpus searches using the original vectors take more than 3 seconds.

The application requires at least 95% recall@20 and p95 retrieval latency below 200 milliseconds. It must return the final 20 passages according to the original embedding model's similarity measure.

Which retrieval configuration should the developer implement?

**Correct answer:** Use the compressed disk-based index to retrieve 200 candidates, rescore those candidates against the retained full-precision vectors using the original similarity measure, and return the highest-ranked 20.

**Explanation:** Compressed candidate retrieval addresses the memory constraint, while expanded candidate retrieval gives full-precision rescoring enough relevant passages to recover ranking quality. The measured configuration meets both the recall and peak-concurrency latency requirements without full-corpus comparisons.

## Practice Vector Search in a full exam

Questions on Vector Search in each practice exam, with every answer option and an explanation for each:

- [AIP-C01](https://blowstack.com/practice-exams/aws-certified-generative-ai-developer-professional): 19 questions
- [MLA-C02 (beta)](https://blowstack.com/practice-exams/aws-certified-machine-learning-engineer-associate): 18 questions
- [DEA-C01](https://blowstack.com/practice-exams/aws-certified-data-engineer-associate): 9 questions
- [AIF-C01](https://blowstack.com/practice-exams/aws-certified-ai-practitioner): 7 questions
- [SAP-C03](https://blowstack.com/practice-exams/aws-certified-solutions-architect-professional): 2 questions

## What is Vector Search

Vector search finds items whose numerical representations are close to a query vector under a chosen similarity measure. An embedding is a vector produced by a model to represent characteristics of an input, such as the meaning of a paragraph or the visual features of an image. For example, a search for “recover account access” might retrieve a document titled “Reset your password” even without matching the query's exact wording. Retrieval quality depends on what the embedding model captures; numerical proximity does not prove relevance or factual correctness.

A typical cloud implementation starts with an ingestion pipeline. The pipeline extracts content, divides long documents into useful chunks, generates an embedding for each chunk, and stores each vector with an identifier and metadata. Source text can reside alongside the vector or in another system accessible through the identifier. At query time, the application embeds the query into a compatible vector space and retrieves the closest matching records. Query and document embeddings must use compatible models and configurations; matching vector dimensions alone does not make unrelated embedding spaces comparable.

In retrieval-augmented generation, or RAG, the application supplies retrieved passages to a foundation model as context. For an internal support assistant, vector search can retrieve troubleshooting instructions that the model uses to draft an answer with source references. The vector database stores and searches embeddings; it does not inherently generate embeddings or write answers. Retrieval does not retrain the foundation model, and providing relevant context does not guarantee that the generated answer will be correct.

Several cloud storage patterns support this design. Amazon OpenSearch Service provides vector indexing and search alongside lexical search and metadata filtering. Amazon Aurora PostgreSQL-Compatible Edition and Amazon RDS for PostgreSQL support the pgvector extension, allowing embeddings to reside near relational records and participate in SQL queries. Within the Amazon Neptune family, Neptune Analytics supports vector similarity search over embeddings associated with graph vertices. This enables similarity retrieval to be combined with relationship analysis. Capabilities differ by engine, deployment option, and extension version, so a service-family name alone is not sufficient to establish support.

Search designs balance accuracy, latency, memory, storage, and update cost. Exact nearest-neighbor search returns the true nearest neighbors under the selected metric. Brute-force exact search compares the query against every eligible vector, while some exact indexing methods can prune candidates without sacrificing exactness. Approximate nearest-neighbor indexes reduce search work at scale but may miss some true nearest neighbors. Their usefulness depends on measured recall and latency for the workload. Cosine similarity, dot product, and Euclidean distance are common comparison methods; select the method and normalization that match the embedding model's guidance.

Vector search does not automatically replace keyword search. Product codes, error identifiers, and precise names often benefit from lexical matching. Hybrid retrieval combines lexical and vector results, and a reranking model can reorder retrieved candidates. Evaluate retrieval with representative questions and relevance judgments rather than interpreting similarity scores as probabilities of correctness. Chunk size, metadata filters, candidate counts, and embedding quality all affect results.

Operational controls are essential. Enforce tenant and document permissions before retrieved content reaches the model; semantic similarity is not authorization. Propagate source updates and deletions to the vector store, and track embedding model versions. Changing models generally requires re-embedding the corpus and rebuilding or migrating indexes. Budget for embedding generation, ingestion, index capacity, replication, and queries. Protect embeddings as potentially sensitive derived data rather than assuming they anonymize their source content.

## Learn Vector Search in lessons

13 short lessons on Vector Search in 5 certification courses.

- AIF-C01: Vector Search: storing embeddings in AWS databases (Premium), https://app.blowstack.com/lessons/vector-search-storing-embeddings-in-aws-databases-aif-c01
- MLA-C02 (beta): Reranking and vector search: reordering versus retrieval (Premium), https://app.blowstack.com/lessons/reranking-and-vector-search-reordering-versus-retrieval-mla-c02
- SAP-C03: Retrieval-Augmented Generation vs. Vector Search (Premium), https://app.blowstack.com/lessons/retrieval-augmented-generation-vs-vector-search-sap-c03
- DEA-C01: Embeddings vs. Vector Search (Premium), https://app.blowstack.com/lessons/embeddings-vs-vector-search-dea-c01
- AIP-C01: Vector Search: scalable index architecture (Premium), https://app.blowstack.com/lessons/vector-search-scalable-index-architecture-aip-c01
- MLA-C02 (beta): Vector Search: vector index configuration (Premium), https://app.blowstack.com/lessons/vector-search-vector-index-configuration-mla-c02
