The Short Answer
Flat vector search answers one question: *what are the top-k records most similar to this one query vector?* That is exactly right for known-item lookup, and exactly wrong when an AI agent does not yet know the right query, when the corpus is huge and heterogeneous, or when the task is exploratory ("what themes are in here," "find the outlier," "cover every category, not just the densest one"). In those cases a single flat retrieval forces the agent to guess a query and hope the top-k happens to span what it needs.
Agentic hierarchical cluster search replaces the guess with a *map*. You cluster the corpus once, offline, into a hierarchy — broad themes at the top, sub-clusters beneath them, individual records at the leaves. At query time the agent navigates that map coarse-to-fine: it scores its goal against a few dozen cluster centroids (cheap), drills into the best-matching branch, and only runs a precise feature search once it has narrowed to a leaf region. It is the difference between searching a library by re-reading every spine and searching it by walking to the right shelf first.
Flat Retrieval vs. Navigating a Hierarchy — When Each Wins
Neither is universally better. Pick by the task:
| Use flat vector search when... | Use hierarchical cluster search when... |
| You have a good query and want the closest matches ("find this product," "this exact clip") | The agent does not know the right query yet and needs to explore before it commits |
| The corpus is small or homogeneous | The corpus is large and diverse, and one query vector cannot span what matters |
| You want the single best answer | You want *coverage* — a representative from each theme, not ten near-duplicates of the densest one |
| Latency per query must be minimal and setup effort near zero | You can afford an offline clustering pass and want an interpretable, auditable search path |
| The task is "known-item lookup" | The task is triage, deduplication, landscape-mapping, or multi-step research |
What the Hierarchy Actually Is
The "map" is not magic — it is clustering output arranged in levels:
For the labels to be stable across runs (so an agent can reason about "the invoices branch" rather than "cluster 7"), promote the clusters into a taxonomy. Discovered taxonomies turn unsupervised clusters into named, navigable categories — the human- and agent-readable version of the same tree.
The Navigation Loop
The agent walks the tree coarse-to-fine. One iteration:
```text 1. Read the current level's centroids/labels (a few dozen, not millions). 2. Score the goal (or the agent's current query embedding) against each centroid. 3. Pick the best branch(es). Optionally keep 2-3 for breadth. 4. If not at a leaf: descend one level, go to step 1. 5. At a leaf region: run a precise feature_search retriever, scoped to this branch. 6. Inspect results. If the branch was wrong, backtrack and try the runner-up. ```text
The key economic property is in step 2: the agent compares its goal against centroids, not against every record. A million-record corpus might sort into a few hundred leaf clusters under a shallow tree, so the agent makes a few hundred comparisons across the whole descent instead of a million — and each comparison is against a summary, not raw data. Coarse-to-fine turns a linear scan into something closer to a logarithmic walk.
Scoping the leaf search is the part people miss. When clustering runs, each document's cluster assignment is written back as a field on that document (the same way any enrichment is joined onto a record). Because it is now just a payload field, a retriever's [
attribute_filter stage](/docs/retrieval/filters) can restrict a normal [feature_search] to one cluster or one taxonomy branch — the same pre-filter-then-search machinery you would use for any metadata filter:```json { "stages": [ { "stage_type": "attribute_filter", "filters": [ { "field": "cluster_label", "operator": "eq", "value": "invoices/2026-Q2" } ] }, { "stage_type": "feature_search", "query": "past-due amount over 5000", "limit": 10 } ] } ```json
That is the whole trick: the hierarchy localizes, the filter scopes, and the feature search ranks within the scope.
Why Agents Prefer It
Honest Limits — Read Before You Build
This is a real pattern, not a turnkey endpoint, and it is only as good as its inputs:
How to Build It in Mixpeek
1. Cluster the collection. Run clustering over the feature space that matches your task (text, image, or a multi-feature combination). This produces centroids and writes a cluster assignment back onto each document. 2. Add levels if you need them. Run composite clustering over those centroids to get a "cluster of clusters" tree, or sub-cluster the largest branches. 3. Stabilize the labels. Promote clusters into a discovered taxonomy so the agent reasons over named branches, not run-specific cluster IDs. 4. Let the agent navigate. The agent reads centroids/labels, scores its goal, and descends — a few dozen comparisons per level. 5. Scope the leaf retrieval. At the chosen branch, run a multi-stage retriever with an [
attribute_filter](/docs/retrieval/filters) on the cluster/taxonomy field plus a feature_search for ranked precision.
6. Close the loop. Feed the descent path and outcome back as retrieval feedback so the agent learns which branches pay off.Start with the retriever stage catalog and taxonomies; if you are still choosing where vectors live, managed indexing and bring-your-own MVS both support the same cluster-scoped filters.
FAQ
How is agentic hierarchical cluster search different from flat vector search? Flat search compares your query against the whole index and returns the top-k nearest records. Hierarchical cluster search compares your goal against a small set of cluster centroids first, descends into the best branch, and only runs a precise vector search once the region is narrow. Flat search is one hop; hierarchical is a guided walk that trades a little setup for coverage, interpretability, and cheaper search over huge, diverse corpora.
Does the agent re-cluster the data on every query? No — and it must not. You cluster once, offline, and the agent navigates that pre-built hierarchy at query time. Clustering is the expensive, batch step; navigation is a handful of cheap centroid comparisons. Re-cluster on a cadence (or when drift is high) to keep the map fresh, but never per query.
When should I not use it? When you have a precise, known-item query and just want the closest matches — flat ANN is simpler and faster. Also skip it when the corpus is small or homogeneous enough that one query vector already spans it, or when your clustering quality is poor: a bad hierarchy misleads the agent more than flat search would.
Is this a built-in Mixpeek feature or something I assemble? You assemble it from primitives Mixpeek already provides: clustering and composite clustering produce the hierarchy, discovered taxonomies give stable labels, and a retriever's attribute_filter scopes a feature search to any branch. There is no single "navigate the tree" endpoint — the navigation loop lives in your agent, and every building block it calls is a first-class part of the platform.