Aggregations — MDDB API

Aggregate metadata facets and date histograms #

POST /v1/aggregate

Compute metadata value counts (facets) and date histograms for a collection. Supports optional metadata pre-filtering to scope the aggregation.

Authorization: BearerAuth or APIKeyAuth or none

Request body #

Required.

Content type application/json: AggregateRequest

{
  "collection": "blog",
  "facets": [
    {
      "field": "category",
      "orderBy": "count"
    }
  ],
  "filter": {
    "kind": {
      "not": [
        "test"
      ]
    },
    "modified": {
      "gte": "2026-09-01"
    },
    "path": {
      "prefix": "internal/"
    },
    "size": {
      "lt": 10000
    },
    "summary": {
      "exists": true
    },
    "title": {
      "contains": "hnsw"
    }
  },
  "histograms": [
    {
      "field": "addedAt",
      "interval": "month"
    }
  ],
  "maxFacetSize": 50
}

Responses #

Status Description Body
200 Aggregation results AggregateResponse (application/json)
400 Invalid request ErrorResponse (application/json)