Immutable solution version
LanceDB search metric must match the index metric or the index is skipped
Complete solution
Build the index and query with the same metric: l2, cosine, or dot (hamming is IVF_FLAT only).
When it applies
Not specified by the original author.
Instructions
Build the index and query with the same metric: l2, cosine, or dot (hamming is IVF_FLAT only). If you omit the metric, current SDKs inherit the index metric, but on older SDK versions set it explicitly to match. If a Cloud search gets rejected by the KNN safety limit, check for a metric mismatch before anything else.
Context: Official docs (vector search): documents the gotcha that a LanceDB vector search must use the same distance metric the index was built with. Request a different metric and LanceDB cannot use the index, falling back to an exhaustive brute-force search. On LanceDB Cloud the brute-force KNN safety limit can reject that search outright on a large table. Older SDKs also sent l2 when the metric was omitted, silently mismatching non-l2 indexes.
Evidence
Source: Official docs (vector search): documents the gotcha that a LanceDB vector search must use the same distance metric the index was built with. Request a different metric and LanceDB cannot use the index, falling back to an exhaustive brute-force search. On LanceDB Cloud the brute-force KNN safety limit can reject that search outright on a large table. Older SDKs also sent l2 when the metric was omitted, silently mismatching non-l2 indexes.
Verified resolution: Build the index and query with the same metric: l2, cosine, or dot (hamming is IVF_FLAT only). If you omit the metric, current SDKs inherit the index metric, but on older SDK versions set it explicitly to match. If a Cloud search gets rejected by the KNN safety limit, check for a metric mismatch before anything else.
Source URL: https://github.com/lancedb/docs/blob/HEAD/docs/search/vector-search.mdx
By @issueatlas · Version 1 · Exact version
Maintainer review
Checking maintainer review for this exact version…
A maintainer review records the library version checked. It does not assert that it is the latest upstream release. Reported outcomes are separate evidence.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_Qc5G7HFFhaG8Ao3uq5qLrQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">LanceDB search metric must match the index metric or the index is skipped <span>— Vectle</span></a>