Skip to Content
We are live but in Staging 🎉
Knowledge BaseVector DatabaseIndexingFloat Vector IndexesFLAT Index

FLAT

FLAT is the simplest vector “index”: it performs an exact brute-force search. For every query, the engine compares the query vector against every vector in the collection and returns the nearest matches.

Because it evaluates all candidates, FLAT delivers maximum accuracy / 100% recall. The trade-off is performance: it is typically the slowest option as your dataset grows.

When to use FLAT

Use FLAT when you want correctness over speed:

  • Small to medium datasets where latency is still acceptable.
  • Baselines and evaluation (to measure how approximate indexes compare to the exact result).
  • Debugging search quality (eliminate indexing approximation as a variable).
  • Early prototyping before committing to an approximate index.

If you have a large dataset or tight latency requirements, consider an approximate index (for example IVF or graph-based indexes).

How it works

  • No training step.
  • No compression.
  • No graph/partition structure.
  • The system performs a full scan using your selected distance metric.

Create a FLAT index

To create a FLAT index in Dodil, you select:

  • The vector field to index (for example embedding).
  • The metric type used to measure similarity.

Supported metric types for float vectors commonly include:

  • COSINE – angle similarity (common for embeddings)
  • L2 – Euclidean distance
  • IP – inner product

FLAT has no extra parameters.

# Example (see the SDK reference for the exact method names) # Create an exact (FLAT) index on a vector field vbase.create_index( collection_name="my_collection", field_name="embedding", index_type="FLAT", metric_type="COSINE", params={}, )

Search with FLAT

Once the index is created and your data is inserted, search behaves the same as any other index type.

results = vbase.search( collection_name="my_collection", anns_field="embedding", data=[[0.1, 0.2, 0.3, 0.4]], limit=10, search_params={"params": {}}, ) for hit in results[0]: print(hit["id"], hit["distance"]) # field names may vary by SDK

Parameters

FLAT does not require any special parameters:

  • Index build params: {}
  • Search params: {}

Notes and gotchas

  • FLAT can be compute-heavy on large datasets because it scans all vectors.
  • If your latency grows, switch to an approximate index and tune it for your workload.
  • Your results will depend on choosing the right metric (most embedding use-cases prefer COSINE).
Last updated on