With document enrichment, you can use basic operations to manipulate document attributes. For example, you can remove document attribute values, modify attribute values using conditions, or create document attributes.
Note
Amazon Q Business can't create a target document attribute field if it isn't already created as an index field.
Topics
Basic operations using the Amazon Q Business API
To apply basic logic, you specify your document attribute configuration using the DocumentAttributeTarget object when you use either the BatchPutDocument API operation or the CreateDataSource operation. Use the following parameters to create your configuration:
-
key
– The target field that you want to manipulate. For example, the keyDepartment
is a field or attribute that holds all the department names associated with the documents. -
value
– The target value for your target attribute. -
attributeValueOperator
– To delete an existing target value, set toDELETE
. The default value for this parameter isUPDATE
.
If a specific condition is met, you can also specify a value to use in the
target field. Set the condition using the DocumentAttributeCondition
object. For example, if the _source_uri
field contains
financial
in its URI value, you can choose to prefill the
target field department
with the target value finance
for the document.
For more information, see the following topics in the Amazon Q Business API Reference:
Basic operations using the
Amazon Q Business console
To apply basic logic using the console
-
Sign in to the AWS Management Console and open the Amazon Q Business console.
-
In Applications, select the name of your application environment from the list of applications.
-
From the left navigation menu, choose Enhancements, and then choose Document enrichments.
-
In Document enrichments, choose Add document enrichment.
-
In Configure basic operations, for Document enrichment source, choose a data source connected to your application environment.
-
To apply basic manipulations to your document fields and content, go to Configure basic operations .
-
Choose Next to save your configuration.
Use cases for basic
operations
This section provides two examples of basic operations.
Example 1: Removing customer identification numbers associated with the documents
The following is an example of using a basic operation to remove all customer
identification numbers in the document field called
customer_id
.
The following table shows the data before basic manipulation is applied.
_document_id | _document_id | customer_id |
---|---|---|
1 | Example text | CID1234 |
2 | Example text | CID1235 |
3 | Example text | CID1236 |
The following table shows the data after basic manipulation is applied.
_document_id | _document_body | customer_id |
---|---|---|
1 | Example text | |
2 | Example text | |
3 | Example text |
Example 2: Creating and prefilling the Department field with department names associated with the documents using a condition
The following is an example of using basic logic to create a field called
Department
and prefillling the field with the department names
based on information from the _source_uri
field. This example uses
the condition that, if the _source_uri
field contains
financial
in its URI value, then the target field
department
is prefilled with the target value
finance
for the document.
The following table shows the data before basic manipulation is applied.
_document_id | document_body | _source_uri |
---|---|---|
1 | Example text | financial/1 |
2 | Example text | financial/2 |
3 | Example text | financial/3 |
The following table shows the data after basic manipulation is applied.
_document_id | _document_body | _source_uri | department |
---|---|---|---|
1 | Example text | financial/1 | Finance |
2 | Example text | financial/2 | Finance |
3 | Example text | financial/3 | Finance |
Code examples of basic
operations
The following instructions give examples of configuring basic data manipulation to remove customer identification numbers associated with the documents.
To configure basic data manipulation to remove customer identification numbers
-
Sign in to the AWS Management Console and open the Amazon Q Business console.
-
From the left navigation pane, select Document enrichments and then select Add document enrichment.
-
On the Configure basic operations page, choose from the data source that you want to alter document fields and content in.
-
Select the document field name Customer_ID from the dropdown menu, and then select the target action Delete.
-
Select Add basic operation.