Docs

Aggregate

Group and count vectors by metadata fields for analytics and faceted browsing.

bashPOST /v1/aggregate

Group vectors in a collection by a metadata key and return counts per group. Useful for building faceted navigation, analytics dashboards, and data quality checks.

ParameterTypeRequiredDescription
collectionstringYesCollection name
group_bystringYesMetadata key to group by
filter_keystringNoFilter to a subset before grouping
filter_valuestringNoValue for the filter key
bash# Count documents by category
curl -X POST https://api.schift.io/v1/aggregate \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $SCHIFT_API_KEY" \
  -d '{
    "collection": "product-docs",
    "group_by": "category"
  }'

# Count within a filtered subset
curl -X POST https://api.schift.io/v1/aggregate \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $SCHIFT_API_KEY" \
  -d '{
    "collection": "product-docs",
    "group_by": "author",
    "filter_key": "category",
    "filter_value": "engineering"
  }'

Response: { "groups": [{"value": "engineering", "count": 42}, ...], "total": 156 }

Backend support

Aggregate is supported by the Schift engine and FAISS backends. Other backends return 501.