You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Propose a design for Search Embedded Aggregation: extend Milvus vector search to return per-group top-K hits and per-group aggregation metrics (avg / sum / count / max / min) in a single request, aligning with Elasticsearch's terms + top_hits + metric sub-aggregation combo.
Motivation
Milvus today supports single-field group_by_field + group_size for grouping search results, but the most common vector-search analytics requests — e.g. "for each document, return the top-2 most similar chunks AND the average / max similarity / chunk count of that document" — cannot be expressed in a single search call. Users must issue two separate requests (search + query aggregation) and stitch results on the client, losing both ergonomics and latency.
Gap Analysis
#
Capability
ES
Milvus master
Gap
R1
Single-field grouping
yes
yes
covered
R2
Per-group top-K hits
yes (top_hits.size)
yes (group_size)
covered
R3
Multi-field flat grouping (ES multi_terms)
yes
segcore foundation only (commit 247d55bb36)
Proxy / QueryNode / SDK
R4
Per-group metrics (avg/sum/count/max/min/...)
yes (20+)
no
core gap
R5
Non-vector sort inside a group
yes
no
uncovered
R6
Hierarchical (nested) grouping
yes
no
uncovered
R4 is the dominant gap.
Scope
R3 — Multi-field flat grouping aligned with ES multi_terms (top segcore work already landed in commit 247d55bb36, Go layer still missing).
R4 — Leaf-level per-group metrics (count / sum / avg / max / min in Phase 1; cardinality / percentiles later).
R5 — Non-vector group-internal sort.
R6 — 2-level nested grouping via proxy-side flattening over composite keys, with group_count_safe_factor and metric_safe_factor knobs controlling two orthogonal approximation errors. Leaf-only metrics in Phase 1.
Commit 247d55bb36 — feat: support search embeded group by — segcore composite-key foundation already merged locally on branch support-embeded-groupby-master.
Summary
Propose a design for Search Embedded Aggregation: extend Milvus vector search to return per-group top-K hits and per-group aggregation metrics (avg / sum / count / max / min) in a single request, aligning with Elasticsearch's
terms+top_hits+ metric sub-aggregation combo.Motivation
Milvus today supports single-field
group_by_field+group_sizefor grouping search results, but the most common vector-search analytics requests — e.g. "for each document, return the top-2 most similar chunks AND the average / max similarity / chunk count of that document" — cannot be expressed in a single search call. Users must issue two separate requests (search + query aggregation) and stitch results on the client, losing both ergonomics and latency.Gap Analysis
top_hits.size)group_size)multi_terms)R4 is the dominant gap.
Scope
multi_terms(top segcore work already landed in commit247d55bb36, Go layer still missing).group_count_safe_factorandmetric_safe_factorknobs controlling two orthogonal approximation errors. Leaf-only metrics in Phase 1.Design Document
A full MEP has been drafted:
design_docs/20260413-search_embedded_agg.md(PR incoming).Related Work
247d55bb36—feat: support search embeded group by— segcore composite-key foundation already merged locally on branchsupport-embeded-groupby-master.cc @MrPresent-Han