# Manage sets of units together

## Operate on multiple units in bulk

In general, ConfigHub supports [bulk operations](../background/concepts/bulk-operations.md), which operate on [filtered](../background/concepts/filters.md) groups of entities of the same entity type, including [units](../background/entities/unit.md).

Bulk patch, delete, and even create operations are supported for most entity types. Bulk patch can be used to perform unit data operations such as [restore](../background/entities/revision.md) and [upgrade](./variants.md).

Additionally, [functions](./functions.md) are invoked in bulk by default, except when operating on a specific revision of a specific unit.

Unit actions, such as Tag, Approve, Apply, Destroy, and Refresh, also support bulk operations. These actions are frequently used as part of a multi-unit [change-and-apply workflow](./change-apply.md). If Apply and Destroy actions need to be performed on the units in a specific order, use [links to express the dependencies](./dependencies.md).

## Selecting the units

First identify a set of units you want to operate on. It may be a _vertical_ subset, like the units belonging to a single [helm chart](./helm-charts.md) or cluster, or a _horizontal_ subset, like all the [variants](./variants.md) of a unit across clusters.

Use a [where expression](../background/concepts/filters.md) with [Labels](../background/concepts/metadata.md) to select the units.

To add a label to make them easier to select using a [where filter](../background/concepts/filters.md), you can use patch:

```
cub unit update --patch --label Application=acme --space acme-dev --where "Slug IN ('frontend', 'backend', 'database', 'cache')"
```

That enables filters to be expressed more concisely:

```
cub unit list --space acme-dev --where "Labels.Application = 'acme'"
```

## Create a saved **Filter**

If this is a set of units you'll frequently want to operate on together, create a saved [Filter](../background/entities/filter.md) to represent them. Using a saved Filter reduces the chances of making mistakes.

Choose a [Space](../background/entities/space.md) to put the Filter in. We recommend choosing a "home space" to put commonly reused entities in, such as Filters, [Views](../background/entities/view.md), and [ChangeSets](./change-apply.md). The [CLI](./cli-usage.md) can store this space as the default space in the context.

```
cub space create acme-home
cub filter create --space acme-home acme-app Unit --where-field "Labels.Application = 'acme'"
```

## Use a saved Filter

Every command that supports `--where` also supports `--filter`. Specify the saved Filter, including its space if it's in not in the default space and not in the space specified on the command line.

```
cub unit approve --space acme-dev --filter acme-home/acme-app
cub unit apply --space acme-dev --filter acme-home/acme-app
```

For more on creating and organizing Filters and Views, see the [Filters and Views guide](./filters-and-views.md).
