◉GEMINI LABJP
●ARGON — gemini-4-argon is generally available as of 10/13, aimed at complex coding, agents, math and science●DEEP RES — deep-research-pro-preview-12-2025 shuts down 10/23, 6 days left. Move to deep-research-preview-04-2026●NANO — gemini-nano-banana-2.1 is GA (10/06). gemini-3.1-flash-image is deprecated with no shutdown date yet●MCP — One write-up cut an 85,000-token tool result to 310 tokens by wrapping it in an ADK FunctionTool●FLASH — gemini-3.7-flash and 3.5-flash now route automatically to newer Flash models (10/08)●NEW — Stop Re-Reading Every Crash Report: Gre…●ARGON — gemini-4-argon is generally available as of 10/13, aimed at complex coding, agents, math and science●DEEP RES — deep-research-pro-preview-12-2025 shuts down 10/23, 6 days left. Move to deep-research-preview-04-2026●NANO — gemini-nano-banana-2.1 is GA (10/06). gemini-3.1-flash-image is deprecated with no shutdown date yet●MCP — One write-up cut an 85,000-token tool result to 310 tokens by wrapping it in an ADK FunctionTool●FLASH — gemini-3.7-flash and 3.5-flash now route automatically to newer Flash models (10/08)●NEW — Stop Re-Reading Every Crash Report: Gre…
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 API249Embedding3Vector SearchArchitecture10Production33RAG14

✦ 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.

✦

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

◈ API / SDK2026-05-15
Three Places Gemini API Embedding Broke on Me — and What Actually Fixed Them
Notes from wiring Gemini API Embedding into an auto-categorization pipeline: INVALID_ARGUMENT from dimension mismatches, 429 rate limits that lost 400 items of work, and weak retrieval quality — plus normalization, checkpointing, and a recall@5 harness that made improvements measurable.
◈ API / SDK2026-04-26
Architecting a Multi-Tenant SaaS on Gemini API — Tenant Isolation, Usage Metering, and Runaway Cost Defense in Production
A field-tested blueprint for serving Gemini API to multiple tenants on a single backend — covering tenant isolation choices, per-tenant rate limiting in Redis, request-level usage metering for billing, and runaway-cost defenses.
⟐ Dev Tools2026-03-30
Firebase Genkit × Gemini API in Production — Design Choices and Gotchas from a Month of Indie Backend Work
Field notes from a month of running Firebase Genkit and Gemini API behind an indie app review-summarization backend. Flow and Tool design, Cloud Functions vs. Cloud Run, real cost and latency numbers, and seven undocumented gotchas.