<a id="hoistfield"></a>

# Kafka Connect HoistField SMT Usage Reference for Confluent Platform

The `HoistField` SMT (`org.apache.kafka.connect.transforms.HoistField`)
wraps an Apache Kafka® record key or value in a single-field Struct or Map, using
the field name you specify.

## Description

The `HoistField` SMT wraps an entire record key or value in a single
named field. If the data has a schema, `HoistField` wraps it in a Struct.
If the data has no schema, `HoistField` wraps it in a Map.

Use the concrete transformation type designed for the record key
(`org.apache.kafka.connect.transforms.HoistField$Key`) or value
(`org.apache.kafka.connect.transforms.HoistField$Value`).

<a id="hoistfield-properties"></a>

## Properties

| Name    | Description                                                                            | Type   | Default   | Valid values   | Importance   |
|---------|----------------------------------------------------------------------------------------|--------|-----------|----------------|--------------|
| `field` | Name of the single field created in the resulting Struct or Map that wraps the record. | string |           |                | medium       |

## Example

The following configuration snippet shows how to use `HoistField` to wrap a
schemaless value in a Map, using `line` as the field name.

```json
"transforms": "HoistField",
"transforms.HoistField.type": "org.apache.kafka.connect.transforms.HoistField$Value",
"transforms.HoistField.field": "line"
```

Messages sent:

```properties
Foo
Bar
```

Topic result:

```properties
{"line":"Foo"}
{"line":"Bar"}
```

## Predicates

Configure transformations with predicates to ensure they process only records
that satisfy a particular condition. You can also use predicates in a
transformation chain with the [Kafka Connect Filter (Kafka) SMT Usage Reference for Confluent Platform](filter-ak.md#ak-filter) to conditionally filter specific
records. For more information, see [Predicates](filter-ak.md#predicates).
