---
schema_version: "1"
id: c1ea108edfe7b9f9c7b31b4c4ce3eec33d1022784c0e93ea6a3e8ac59bf8c197
title: Use a Custom Chunking Function in a Search Index
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/data-cloud/data-cloud-code-ext/guides/function/use-chunking-in-search-index.md
canonical_url: https://developer.salesforce.com/docs/data/data-cloud-code-ext/guide/use-chunking-in-search-index.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: b9a6ab23a165639446448ff84500bc820d33208396e4f09b852b59fd748a8fae
products:
  - Data 360 Code Extension Guide
  - Data 360 Developer Documentation
---
# Use a Custom Chunking Function in a Search Index

After you deploy a custom chunking function, use it in a search index by creating a search index with Advanced Setup and selecting your function as the Chunking Strategy for the fields you want to chunk.

| Edition Table                                                                                                                                                                                                 |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Available in: **Developer**, **Enterprise**, **Performance**, and **Unlimited** Editions. See [Data 360 edition availability](https://help.salesforce.com/s/articleView?id=sf.c360_a_dc_editions.htm&type=5). |

| User Permissions Needed                              |                                                        |
| ---------------------------------------------------- | ------------------------------------------------------ |
| To use a custom chunking function in a search index: | Permission set: <ul><li>Data Cloud Architect</li></ul> |

## Prerequisites

- Deploy your custom chunking function and make sure that its deployment status is Deployed. See [Deploy a Custom Function to Data 360 by Using UI](https://developer.salesforce.com/docs/data/data-cloud-code-ext/guide/deploy-custom-function.md).
- Confirm that the content you want to chunk, for example, an uploaded PDF, is ingested and is available as the data model object (DMO) or unstructured DMO (UDMO) that your search index uses. Chunking runs only on content that exists in the selected source; if a document didn't upload or ingest successfully, no chunks are created for it.

## Use Your Function in a Search Index

1. In Data 360, go to the Search Indexes and click **New**.

   If the tab is not visible, use **More** to find Search Index.

2. Select **Advanced Setup** and click **Next** to open the full Search Index Builder.

3. In the Search Index Builder, select the data model object that contains the data you want to chunk (for example, a DMO with unstructured or text fields). Click **Next**.

4. In the **Select Fields To Chunk** section, click **Manage Fields**.

5. In the Manage Fields modal, select the fields you want to chunk with your custom function (for example, a description or long-text field). Click **Save**.

6. For each field you want to chunk with your custom code:
   - In the dropdown next to the field name, set **Chunking Strategy** to **Code Extension**.
   - Select your deployed custom function from the Function Name list.
   - Click **Save**.

7. Click **Next** and complete the rest of the search index configuration (for example, embedding model for vectorization, fields for filtering, and index name and API name).

8. Click **Save** to create the search index.

   Saving can take several minutes. Stay on the page until the builder finishes or shows an error.

9. After the search index is created, reload the record page and wait until Search Index Last Run Status shows Ready before verifying chunked data. This can take several minutes.

## Next Steps

- [Verify Custom Chunking Results](https://developer.salesforce.com/docs/data/data-cloud-code-ext/guide/verify-chunking-results.md)
- [Query Code Extension Logs by Using Query Editor](https://developer.salesforce.com/docs/data/data-cloud-code-ext/query-logs-queryeditor.md)
- [Query Code Extension Logs by Using the Query API](https://developer.salesforce.com/docs/data/data-cloud-code-ext/query-logs-api.md)

## See Also

- [Use Custom Functions in Data 360](https://developer.salesforce.com/docs/data/data-cloud-code-ext/guide/use-custom-function.md)
- [Migrate Custom Function to Production](https://developer.salesforce.com/docs/data/data-cloud-code-ext/guide/migrate-custom-function-to-production.md)
