Collapse

Field collapsing

/ Collapse, / Deduplication, / Search

Field collapsing #

Collapse the result list so each distinct value of a field appears at most once — “best product per merchant”, “best article per author” — without a terms aggregation, keeping full hit semantics (scores, source, highlight).

POST /my-collection/_search

How it works #

Collapse is engine-native and runs as a post-retrieval step. The collector normally stops at from + size, but collapse pages over GROUPS, so the engine first gathers a wider window — max(1000, from + size) hits (COLLAPSE_WINDOW in lib/engine/src/search/mod.rs) — in request sort order, then:

...