Repository navigation
Conversation
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
Code Review ✅ Approved 🔴 High riskAdding embedding-model fields across entity and chunk mappings upgrades catalog search schemas; the first reindex may re-embed all vectors, changing retrieval and provider load. Stores the embedding model id and dimension on every vector-bearing entity and chunk doc, and reuses a stored vector only when its fingerprint matches and its recorded model equals the configured one. This fixes stale vectors surviving a model switch of the same dimension across reindex, chunk backfill, live edits, and VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
Describe your changes:
Follow-up to PR #38415 and PR #38517, and the document-level half of PR #38845: that PR flags an index built for another model, this one makes the rebuild replace its vectors.
The bug. After a switch to another embedding model of the same vector size, OpenMetadata keeps the old model's vectors. Every path keeps a stored vector while its fingerprint (a hash of the entity's text) matches, and a model switch changes no text. So reindex, the chunk backfill, live edits and
reembedall keep them, and semantic search silently compares new-model queries with old-model vectors.reembedembeds nothing and reports success. Chunk reuse never checked the vector size either.What changes.
embeddingModel(model id) andembeddingDimension, on entity docs and chunk docs, mapped in every index (chunk doc version 9 adds them to existing chunk indexes).EmbeddingModel,StoredEmbeddingReuse,ChunkHeader.holdsVectorsOf). Fingerprint and model stay separate facts; the dimension is part of the model.reembedignores stored vectors, counts an entity only when both writes succeed, and exits 1 when any entity failed.Decision record: ADR:2026-11-11-reindex-reuses-an-embedding-only-when-its-fingerprint-matches, amended (v3).
Upgrade note. No existing doc records its model, so every embedded entity is embedded once more by the first reindex (or write) that touches it: one paid provider call per chunk, the cost of embedding the catalog once. Locally, 22 entities written by main cost 23 calls on the first Search Indexing (22 chunks, one pre-flight), then 1.
Type of change:
Tests:
EmbeddingModelSwitchTest(in-memory engine, two stub models of one dimension). On main 7 of 10 cases and the newEmbeddingEnricherTestsplice case fail (model B never called); the same-model controls pass. Here all pass.StoredEmbeddingReuseIT, OpenSearch 3.4.0 and Elasticsearch 9.3.0: 6/6; on main the 2 new scenarios fail on both.JobRecoveryOrphanDetectionTest) fails on main too.OntologyTermBulkWriteonly takes the shared field list and rule, so has no unit test.Manual testing performed
Elasticsearch 9.3.0, MySQL, a stub with two 16-dimension models (B permutes A's space). 22 entities embedded with A, then switched to B:
reindex --forceagainreembedweatherfirstChecklist: