younifyd
Menu

Aggregate over a collection

Aggregate over a collection

POST/v1/aggregate/{collection}

Use it in a workflow

  1. Add a step and choose the Weaviate connector.
  2. Pick the Aggregate over a collection action (under aggregate).
  3. Fill in the fields below, then reference the result from later steps as {{aggregateOverACollection.response.data}}.

Request

Path parameters

collectionstringrequired

The name (or alias) of the collection to aggregate over. A lowercase first letter is normalized to the canonical uppercase form.

Request body

Enter the body as JSON in the step's Body field.

groupBystring

The property to group by, as a bare property name. Each distinct value of the property forms one group (an object whose property holds several values counts toward each of them). Omitted or empty aggregates over all matching objects without grouping.

returnMetricsarray<string>

The aggregation metrics to return. Phase 1 supports only `count` (the number of matching objects, per group when `groupBy` is set); omitted or empty is equivalent to `["count"]`. The property-scoped `property:statistic` grammar (e.g. `price:mean`) is reserved and returns 422 (not yet supported).

whereobject

Filter search results using a where filter.

operandsarray<object>

Combine multiple where filters, requires 'And' or 'Or' operator.

operatorstring

Operator to use.

One ofAndOrEqualLikeNotEqualGreaterThanGreaterThanEqualLessThanLessThanEqualWithinGeoRangeIsNullContainsAnyContainsAllContainsNoneNot

patharray<string>

Path to the property currently being filtered.

valueIntinteger (int64)

value as integer

valueNumbernumber (float64)

value as number/float

valueBooleanboolean

value as boolean

valueStringstring

value as text (deprecated as of v1.19; alias for valueText)

valueTextstring

value as text

valueDatestring

value as date (as string)

valueIntArrayarray<integer (int64)>

value as integer

valueNumberArrayarray<number (float64)>

value as number/float

valueBooleanArrayarray<boolean>

value as boolean

valueStringArrayarray<string>

value as text (deprecated as of v1.19; alias for valueText)

valueTextArrayarray<string>

value as text

valueDateArrayarray<string>

value as date (as string)

valueGeoRangeobject2 fields

Filter within a distance of a georange.

limitinteger (int64)

The maximum number of groups to return, largest first. Must be positive and requires `groupBy`; omitted falls back to the server default (100 groups).

tenantstring

The tenant to aggregate in a multi-tenant collection.

overobject

Reserved for aggregate-over-search (aggregating the results of a vector, keyword or hybrid search). Returns 422 (not yet supported).

objectLimitinteger (int64)

Reserved for aggregate-over-search (the maximum number of search results to aggregate). Returns 422 (not yet supported).

json
{
  "groupBy": "string",
  "returnMetrics": [
    "string"
  ],
  "where": {
    "operands": [
      {}
    ],
    "operator": "GreaterThanEqual",
    "path": [
      "inCity",
      "city",
      "name"
    ],
    "valueInt": 2000,
    "valueNumber": 3.14,
    "valueBoolean": false,
    "valueString": "my search term",
    "valueText": "my search term",
    "valueDate": "TODO",
    "valueIntArray": "[100, 200]",
    "valueNumberArray": [
      3.14
    ],
    "valueBooleanArray": [
      true,
      false
    ]
  },
  "limit": 0,
  "tenant": "string",
  "over": {},
  "objectLimit": 0
}

Response

Returns 200 with a any. Read it in later steps with {{aggregateOverACollection.response.data.<field>}}.

Need more? See the Weaviate guide for connection setup and behaviour shared by every action.

Was this page helpful?