---
title: "aggregation · RUAL Documentation"
description: "Build an aggregation on the given query."
canonical: https://docs.rual.nl/block-types/query/query_aggregation
language: en
---

# aggregation

This block is part of the [`query`](https://docs.rual.nl/block-types/query) group and was last modified in core [`v13.0.4`](https://docs.rual.nl/core-versions/130004).

### Connection Type

This block connects from a `query` type block. Make sure to connect this block to the appropriate left-hand side connection.

Build an aggregation on the given query.

- Name required `value`

- Type required `aggregation`

- Sub. aggregation `query` Suggestions: `query_aggregation`

- Range Filter `query` Suggestions: `query_bool_range_gt` `query_bool_range_gte` `query_bool_range_lte` `query_bool_range_lt`

- Meta Data `v13.0.4` `object` To associate custom metadata with an aggregation

- query `query`

A typical wiring for [aggregation](https://docs.rual.nl/block-types/query/query_aggregation): [value](https://docs.rual.nl/block-types/value/value_default) feeds the `name` pin; [cardinality](https://docs.rual.nl/block-types/aggregation/aggregation_type_cardinality_bp_field) feeds the `type` pin; the `query` out pin feeds [search](https://docs.rual.nl/block-types/storage/function_search).

![Studio canvas example for the aggregation block: typical wiring for aggregation.](https://docs.rual.nl/canvas-examples/query_aggregation.png)

### Commonly used with

In production blueprints, this block is most often wired together with:

- [search](https://docs.rual.nl/block-types/storage/function_search): this block feeds into it. searches in the given storage based on a query.

- [value](https://docs.rual.nl/block-types/value/value_default): feeds into this block. Simply returns the provided value.

- [cardinality](https://docs.rual.nl/block-types/aggregation/aggregation_type_cardinality_bp_field): feeds into this block. Counts the approximate number of distinct values for the specified field.

- [terms](https://docs.rual.nl/block-types/aggregation/aggregation_type_terms_bp_field): feeds into this block. Performs term-based grouping, allowing aggregation on specified criteria.

- [count on field](https://docs.rual.nl/block-types/aggregation/aggregation_type_value_count_bp_field): feeds into this block. Counts the occurrences of values in the specified numeric, date, or value field.

### Version history

Introduced in [`v13.0.4`](https://docs.rual.nl/core-versions/130004).
