> [!CAUTION]
> **Caution** : Document AI Warehouse is deprecated and will no longer be available on Google Cloud after January 16, 2025. To safeguard your data, migrate any documents currently saved in Document AI Warehouse to an alternative like Cloud Storage. Verify that your data migration is completed before the discontinuation date to prevent any data loss. See [Deprecations](https://docs.cloud.google.com/document-warehouse/docs/deprecations) for details.

<br />

> [!WARNING]
>
> **Preview**
>
>
> This feature is
>
> subject to the "Pre-GA Offerings Terms" in the General Service Terms section of the
> [Service Specific
> Terms](https://docs.cloud.google.com/terms/service-terms#1).
>
> Pre-GA features are available "as is" and might have limited support.
>
> For more information, see the
> [launch stage descriptions](https://cloud.google.com/products/#product-launch-stages).

This document describes how to update existing documents with newly processed
results from another Document AI processor.

## Current limitations

The [ProcessWithDocAi
pipeline](https://docs.cloud.google.com/document-warehouse/docs/reference/rest/v1/projects.locations/runPipeline#ProcessWithDocAiPipeline)
can only work with documents that have been processed during the ingestion.
Future versions of the pipeline will expand this pipeline to documents that are
not processed yet. Please stay tuned for updates in our [release
notes](https://docs.cloud.google.com/document-warehouse/docs/release-notes).

## Configure schema mapping in document schema (admin only)

The [Set schemas with mapping](https://docs.cloud.google.com/document-warehouse/docs/set-schema-with-mapping)
document describes how to configure new or existing properties of a
Document AI Warehouse schema to be mapped with extracted entities from
Document AI. We demonstrate how to do this in the
Document AI Warehouse admin console.

### Go to the Document AI Warehouse admin console

Ensure that you have admin access. Then you can go to the [admin
console](https://documentwarehouse.cloud.google.com/admin).

![Admin UI link](https://docs.cloud.google.com/static/document-warehouse/docs/images/pipeline-ui/enable_pipelines_step1.png)

### Create a new schema with schema mapping

You can create a new schema with schema mapping, and the same steps can apply to
existing schemas by updating schemas in the schema details view. Just note that
schema-update functionalities are currently limited. We do not support removing
or modifying existing properties.

1. Click **Add new** in the Schema manager tab:

   ![Step 1](https://docs.cloud.google.com/static/document-warehouse/docs/images/pipeline-ui/create_schema_with_mapping_step1.png)
2. Enter a display name and description.

   ![Step 2](https://docs.cloud.google.com/static/document-warehouse/docs/images/pipeline-ui/create_schema_with_mapping_step2.png)

   Note that you cannot modify display name after creation. Description is
   optional and can be updated after creation.
3. Click **Next**. The JSON editor of the schema appears, including the display
   name and description entered in the previous step.

   ![Step 3](https://docs.cloud.google.com/static/document-warehouse/docs/images/pipeline-ui/create_schema_with_mapping_step3.png)

   In this example, add a **total_amount** property to
   **property_definitions** list:

           {
               "name": "total_amount",
               "display_name": "Total Amount",
               "is_repeatable": false,
               "is_filterable": true,
               "is_searchable": true,
               "is_metadata": false,
               "is_required": false,
               "float_type_options": {},
               "schema_sources": [
                   {
                           "name": "total_amount",
                           "processor_type": "INVOICE_PROCESSOR"
                   }
               ]
           }

   The property is configured to be mapped to the `total_amount` field
   extracted by `INVOICE_PROCESSOR`. To get the full list of processor types,
   you can use the [fetchProcessorTypes
   API](https://docs.cloud.google.com/document-ai/docs/reference/rest/v1/projects.locations/fetchProcessorTypes#google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes).

   > [!NOTE]
   > **Note:** More details about property definitions can be found in [this
   > documentation](https://docs.cloud.google.com/document-warehouse/docs/reference/rest/v1/projects.locations.documentSchemas#propertydefinition).

4. To create a schema, click **Done**. A confirmation message shows up after
   completion:

   ![Step 4](https://docs.cloud.google.com/static/document-warehouse/docs/images/pipeline-ui/create_schema_with_mapping_step4.png)
5. You can view the schema in detail.

   ![Step 5](https://docs.cloud.google.com/static/document-warehouse/docs/images/pipeline-ui/create_schema_with_mapping_step5.png)

## Example: Use an invoice processor for the OCR-processed documents

With the property mapping defined in the schema, you can reprocess the
OCR-processed documents with an invoice processor, which has the `total_amount`
property mapped from parsed results.

1. Select documents to reprocess.

   Select documents that you want to apply another processor to. Then click
   **Extract with Document AI** on the action bar.

   ![Step 1](https://docs.cloud.google.com/static/document-warehouse/docs/images/pipeline-ui/extract_with_docai_step1.png)

   The pop-up dialog box has three input fields:
   1. **Processor ID**: processor ID that you want to use to process the
      documents.

   2. **Export file path**: a staging bucket path to temporary store the
      documents.

   3. **Processor results folder path**: a bucket path to store the processor
      parsed documents.

   ![Step 2](https://docs.cloud.google.com/static/document-warehouse/docs/images/pipeline-ui/extract_with_docai_step2.png)

   > [!NOTE]
   > **Note:** Currently, the maximum number of selected documents is **3,000** . If the number of documents in the search results exceeds 3,000, **Select
   > All Search Results** is disabled. Refine your search or filter criteria to reduce the amount of documents in the search results.

2. Get the invoice processor ID.

   Similar to creating the OCR parser in the [bulk upload
   guide](https://docs.cloud.google.com/document-warehouse/docs/pipeline-ui-bulk-upload#create_an_ocr_processor_and_get_processor_id),
   you can create an invoice processor from the [processor gallery](https://console.cloud.google.com/ai/document-ai/processor-library).

   ![Step 3](https://docs.cloud.google.com/static/document-warehouse/docs/images/pipeline-ui/extract_with_docai_step3.png)

   Find the ID on the Processor Details page:

   ![Step 4](https://docs.cloud.google.com/static/document-warehouse/docs/images/pipeline-ui/extract_with_docai_step4.png)
3. Trigger the pipeline and track the status.

   After putting the ID and two bucket paths in the dialog, you can click
   **Extract** to trigger the pipeline:

   ![Step 5](https://docs.cloud.google.com/static/document-warehouse/docs/images/pipeline-ui/extract_with_docai_step5.png)
4. After triggering the pipeline, a status tracking page appears:

   ![Step 6](https://docs.cloud.google.com/static/document-warehouse/docs/images/pipeline-ui/extract_with_docai_step6.png)

   Currently, the page does not have in-progress tracking. The status page
   shows pending until the job is complete.
5. Examine the updated results.

   Once the job is completed, you can click the document to examine whether the
   extraction results have been updated correctly.

   ![Step 7](https://docs.cloud.google.com/static/document-warehouse/docs/images/pipeline-ui/extract_with_docai_step7.png)

   You can see the `total_amount` property has been mapped from parsed results.

   ![Step 8](https://docs.cloud.google.com/static/document-warehouse/docs/images/pipeline-ui/extract_with_docai_step8.png)

   In the AI view, you can find the complete list of extracted entities:

   ![Step 9](https://docs.cloud.google.com/static/document-warehouse/docs/images/pipeline-ui/extract_with_docai_step9.png)

   > [!NOTE]
   > **Note:** The entity mapping also works with Bulk Upload with Document AI.

## Next step

Follow [the next guide](https://docs.cloud.google.com/document-warehouse/docs/pipeline-ui-export-to-cdw) to
export the documents to a [Custom Document
Extractor](https://docs.cloud.google.com/document-ai/docs/workbench/build-custom-processor) in
Document AI workbench.