v5

OpenAPI 3.1.02026-08-025631,1012.8 MB
Collection Documents

Return distinct values for a single field.

Return the set of unique values for one document field across a collection, together with a per-value document count sorted desc. Thin wrapper over /aggregate for the common SELECT DISTINCT <field> case — use this when a UI needs a facet list (e.g. brand_slug) without loading every document. Null/missing values are excluded.

post/v1/collections/{collection_identifier}/documents/distinct

Path parameters

collection_identifierstring required

The unique identifier of the collection.

The unique identifier of the collection.

Request body

fieldstring required

Document field whose distinct values should be returned. Dotted paths are supported (e.g. metadata.brand_slug). Null/missing values are excluded.

filtersobject nullable

Optional pre-aggregation filters, same syntax as the standard aggregation endpoint. Applied before distinct values are computed.

limitinteger nullable

Maximum number of distinct values to return (sorted by count desc). Defaults to no limit on the server side; for high-cardinality fields always set a limit to keep the response bounded.

Example request

{
  "field": "brand_slug"
}

Response

Successful Response

fieldstring required

The field that was queried.

total_distinctinteger required

Number of distinct values in the response (== len(values)). When limit is set this can be less than the true cardinality.