

# Create a data mapping

You add connection mappings when you create an Agent Context, and you add or change them later from the Agent Context’s **Connection mappings** tab. A mapping is not a resource of its own; it belongs to the Agent Context.

To add a connection mapping:

1. Confirm that the connection you want to map is active. See [Check connection status](check-connection-status.md).

1. Choose **Add connection mapping**, and then choose the connection.

1. Choose the ontologies to apply, within the rules in [What a data mapping is: ontologies paired with one filtered source, producing one sub-graph](what-a-data-mapping-is.md).

1. (Optional) Under **Data filtering**, narrow what the mapping ingests. To build from everything the connection’s scope selects, leave the filters empty.

1. Save the mapping.

A connection mapping has the following settings.


| Setting | What it does | 
| --- | --- | 
| Connection | The data source to build from. The connection must be in your account and active. | 
| Ontologies | Up to 10 ontologies to apply to the data this mapping ingests. | 
| Data filters | Narrow what the mapping ingests. Up to 10 filters; an item is ingested if it matches at least one filter, and every condition in a filter must hold. Each filter can set a **Created after** date, a **Last modified** date, and tags to include or exclude (up to 25 per filter). For a knowledge base connection, a filter can also set **File type** (PDF, DOCX, MD, TXT, HTML, or CSV) and **Max document size** (up to 50 MB). An empty filter matches everything. | 
| Path | Limits the mapping to one branch of the source’s hierarchy, such as one database and table. The levels depend on the source: database and table for AWS Glue Data Catalog; namespace, database, schema, and table for a federated source such as Amazon Redshift; database, schema, and table for Snowflake; catalog, schema, and table for Databricks. One mapping names one branch. | 
| Extraction depth | How much extraction runs on a knowledge base connection. **Standard** is the only option. | 

When you save the mapping, AWS Context starts ingestion for the selected data and begins building the sub-graph. For how ingestion runs and how to monitor it, see [Ingestion](ingestion.md) and [Monitor build status](monitor-build-status.md).

Through the API, a connection mapping is an entry in the `connectionMappings` list of `CreateAgentContext` or `UpdateAgentContext`. Each entry carries `connectionId`, `ontologyMappings`, and optionally `dataFilter`, `pathSegments`, and `extractionDepth`. If you map two connections that reach the same data, AWS Context reads that data through the connection whose mapping you created first. For more information, see [When several connections reach the same data](how-access-controls-apply-when-aws-context-queries-data.md#overlapping-connections).