Delete documents from a knowledge base directly
To delete specific documents from your data source, send a DeleteKnowledgeBaseDocuments request with an Agents for Amazon Bedrock build-time endpoint and specify the IDs of the data source and the knowledge base it's connected to.
For each document that you want to delete, add a DocumentIdentifier item in the documentIdentifiers
array in one of the following formats:
-
If the data source is a custom one, specify the ID of the document in the
id
field:{ "custom": { "id": "string" }, "dataSourceType": "CUSTOM" }
-
If the data source is an Amazon S3 one, specify the S3 URI of the document in the
uri
field:{ "dataSourceType": "S3", "s3": { "uri": "string" } }
Warning
Documents that you delete directly from a knowledge base connected to an S3 data source aren't deleted from the S3 bucket itself. We recommend that you delete these documents from the S3 bucket, so that they aren't reintroduced if you sync your data source.