## TL;DR

TiFlash nodes must be deployed in the cluster first; the feature relies on TiFlash replicas, so set TIFLASH REPLICA 1 before creating the index unless it is in CREATE TABLE. Only VEC_COSINE_DISTANCE and VEC_L2_DISTANCE are indexable.

## Fix

1. TiFlash nodes must be deployed in the cluster first; the feature relies on TiFlash replicas, so set TIFLASH REPLICA 1 before creating the index unless it is in CREATE TABLE.
   Expected: You get the expected result; the problem is gone.

## When to use

- You are setting up or using this TiDB vector index restrictions feature.
- The symptom matches: TiFlash required, cosine and L2 only.

## When NOT to use

- Unrelated TiDB vector index restrictions issues (different feature, different failure).
- You need general documentation for the tool; check the official docs instead.

## Compatibility

Reported against TiDB vector index restrictions (mentions v8.4, v8.5). Source: https://docs.pingcap.com/tidb/dev/vector-search-index/.

## Variant phrasings

### TiFlash required, cosine and L2 only

## Why it happens

TiDB vector search indexes have hard restrictions. Hitting one produces a confusing failure far from the real cause.

## Edge cases

- If your error message differs even slightly, this is probably a different issue; search the exact text.
- Behavior can change between releases; the linked source reflects the versions above.
- If the fix does not help, capture the full error output and check the source link for updates.

## Source

https://docs.pingcap.com/tidb/dev/vector-search-index/