GEMINI LABJP
NANOLITE — Nano Banana 2 Lite is here: Google's fastest and most cost-efficient Gemini Image model, made for running lightweight image generation cheaplyOMNIFLASH — Gemini Omni Flash is in public preview, a natively multimodal model that lets enterprises and developers build custom, dynamic video workflowsAGENTS — Managed Agents expand with background: true for async server-side runs and polling, remote MCP server integration, and refreshing credentials across interactionsMEMORY — The Memory Bank IngestEvents API is generally available, decoupling event ingestion from memory generation so you can stream content continuouslyTHROUGHPUT — Provisioned Throughput now lets you submit up to seven pending orders for the same model and regionDEPRECATE — Image generation models shut down on August 17, and the Grok 4.1 family on the Gemini Enterprise Agent Platform on August 20NANOLITE — Nano Banana 2 Lite is here: Google's fastest and most cost-efficient Gemini Image model, made for running lightweight image generation cheaplyOMNIFLASH — Gemini Omni Flash is in public preview, a natively multimodal model that lets enterprises and developers build custom, dynamic video workflowsAGENTS — Managed Agents expand with background: true for async server-side runs and polling, remote MCP server integration, and refreshing credentials across interactionsMEMORY — The Memory Bank IngestEvents API is generally available, decoupling event ingestion from memory generation so you can stream content continuouslyTHROUGHPUT — Provisioned Throughput now lets you submit up to seven pending orders for the same model and regionDEPRECATE — Image generation models shut down on August 17, and the Grok 4.1 family on the Gemini Enterprise Agent Platform on August 20
Articles/Advanced
Advanced/2026-05-31Advanced

The Day You Switch Gemini Embedding Models: Designing a Zero-Downtime Reindex

Upgrade your embedding model and every vector you ever stored becomes incompatible. Here is a dual-index design for re-embedding hundreds of thousands of vectors without downtime, complete with a resumable reindex job and a query-side abstraction layer.

Gemini API192Embedding3Vector Search2Architecture9Production32RAG14

Premium Article

The Day You Switch Gemini Embedding Models: Designing a Zero-Downtime Reindex

Embedding-based search has a way of working quietly for a long time. Across the apps I have run since 2014, I use embeddings for semantic clustering of reviews and for FAQ search, and they keep working for months without a second thought. Then one day the question always arrives: "I want to move to a newer embedding model. But what happens to the hundreds of thousands of vectors I already built?"

Let me give the answer first. Vectors produced by different models cannot be compared. If you query a corpus embedded with model A using a query embedded with model B, your search results break — quietly, but surely. No error is raised, because if the dimensions happen to match, the math still runs. That is exactly what makes it dangerous. In this article we will build, with working code, a design that re-embeds your entire corpus without taking the service down and without degrading search quality.

Why "just re-embed it" is not enough

Different embedding models live in different spaces. The map of meaning that text-embedding-004 draws does not share a coordinate system with the one gemini-embedding-001 draws. Even the word "cat" lands somewhere else.

This is where many people first stumble: the dimension trap. If the old and new models happen to return the same dimensionality (say, 768), your cosine similarity computation runs without complaint. No exception, no warning. What comes out is "plausible but subtly wrong" results. Users feel that "search seems a little worse lately," but the cause is never pinned down and the problem festers. This is a pattern I genuinely broke a sweat over early in operations, and it taught me that "appearing to work" is the single greatest risk.

In other words, switching models is not a matter of editing one line on the query side. It means rebuilding every vector on the corpus side in the new space (reindexing). And that rebuild costs hundreds of thousands of API calls, non-trivial money, and a meaningful amount of time.

The overall design: dual index (blue/green)

The key to a zero-downtime switch is the same idea as a database schema migration. You quietly build the new index in the background and cut over only after you have verified its quality.

Concretely, proceed in five phases.

  1. Prepare the new index: provision storage for the new model separately from the old index.
  2. Re-embed in the background: re-embed every document with the new model and write to the new index. The old index keeps serving search the whole time.
  3. Dual-write: during the migration window, write every newly added or updated document to both the old and the new index, so the rebuild never falls behind.
  4. Shadow and canary: route a fraction of queries to the new index too and compare results. If all is well, switch reads to the new index.
  5. Decommission the old index: keep it around for rollback for a while, then delete it once you are confident.

To support this flow, we first make sure every vector records which model produced it. That is the foundation of the whole thing.

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
Understand exactly why a new embedding model makes old vectors incompatible, and how to detect that silent mismatch
Design a dual-index migration that re-embeds hundreds of thousands of documents without downtime, with a resumable reindex job
Estimate the token cost of re-embedding up front and run it safely within rate limits
Secure payment via Stripe · Cancel anytime

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Gemini Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $10 for lifetime access
View Membership →

Related Articles

Advanced2026-06-01
Trimming Gemini Embeddings from 3072 to 768 Dimensions: A Matryoshka Approach to Cutting Vector DB Cost and Latency
gemini-embedding-001 returns 3072-dimensional vectors, but thanks to Matryoshka representation you can keep only the leading dimensions with almost no quality loss. This is a design for trimming to 768 to cut vector DB storage and latency, including the re-normalization pitfall and coarse-to-fine search code.
Advanced2026-07-08
When Your Knowledge Base Shifts Mid-Run: Pinning File Search to an Execution Epoch for Consistent Agent Grounding
When a File Search store is updated while a Managed Agent is running, a single execution can mix old and new grounding. Borrowing MVCC ideas, pinning an execution epoch keeps one agent run's evidence consistent. Here is the design and implementation.
Advanced2026-07-08
One File Search Store for Many Apps: Splitting Retrieval With customMetadata and Chunk Config
Put several apps' FAQs in a single Gemini File Search store and metadataFilter can silently return empty grounding, or answers get split across chunk boundaries. Here is the customMetadata design, the AIP-160 filter-syntax trap, and measured chunkingConfig tuning.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →