knowledge_base_documents
Creates, updates, deletes, gets or lists a knowledge_base_documents resource.
Overview
| Name | knowledge_base_documents |
| Type | Resource |
| Id | aws.bedrock_agent.knowledge_base_documents |
Fields
The following fields are returned by SELECT queries:
- get_knowledge_base_documents
- list_knowledge_base_documents
| Name | Datatype | Description |
|---|---|---|
document_details | array | A list of objects, each of which contains information about the documents that were retrieved. |
| Name | Datatype | Description |
|---|---|---|
data_source_id | string | The identifier of the data source connected to the knowledge base that the document was ingested into or deleted from. (pattern: <code>[0-9a-zA-Z]{10}</code>) |
identifier | object | Contains information that identifies the document. |
knowledge_base_id | string | The identifier of the knowledge base that the document was ingested into or deleted from. (pattern: <code>[0-9a-zA-Z]{10}</code>) |
status | string | The ingestion status of the document. The following statuses are possible: STARTING – You submitted the ingestion job containing the document. PENDING – The document is waiting to be ingested. IN_PROGRESS – The document is being ingested. INDEXED – The document was successfully indexed. PARTIALLY_INDEXED – The document was partially indexed. METADATA_PARTIALLY_INDEXED – You submitted metadata for an existing document and it was partially indexed. METADATA_UPDATE_FAILED – You submitted a metadata update for an existing document but it failed. FAILED – The document failed to be ingested. NOT_FOUND – The document wasn't found. IGNORED – The document was ignored during ingestion. DELETING – You submitted the delete job containing the document. DELETE_IN_PROGRESS – The document is being deleted. (INDEXED, PARTIALLY_INDEXED, PENDING, FAILED, METADATA_PARTIALLY_INDEXED, METADATA_UPDATE_FAILED, IGNORED, NOT_FOUND, STARTING, IN_PROGRESS, DELETING, DELETE_IN_PROGRESS) |
status_reason | string | The reason for the status. Appears alongside the status IGNORED. |
updated_at | string (date-time) | The date and time at which the document was last updated. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_knowledge_base_documents | select | knowledge_base_id, data_source_id, region | Retrieves specific documents from a data source that is connected to a knowledge base. For more information, see Ingest changes directly into a knowledge base in the Amazon Bedrock User Guide. | |
list_knowledge_base_documents | select | knowledge_base_id, data_source_id, region | Retrieves all the documents contained in a data source that is connected to a knowledge base. For more information, see Ingest changes directly into a knowledge base in the Amazon Bedrock User Guide. | |
delete_knowledge_base_documents | delete | knowledge_base_id, data_source_id, region | Deletes documents from a data source and syncs the changes to the knowledge base that is connected to it. For more information, see Ingest changes directly into a knowledge base in the Amazon Bedrock User Guide. | |
ingest_knowledge_base_documents | exec | knowledge_base_id, data_source_id, region, documents | Ingests documents directly into the knowledge base that is connected to the data source. The dataSourceType specified in the content for each document must match the type of the data source that you specify in the header. For more information, see Ingest changes directly into a knowledge base in the Amazon Bedrock User Guide. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
data_source_id | string | The unique identifier of the data source connected to the knowledge base that you're adding documents to. |
knowledge_base_id | string | The unique identifier of the knowledge base to ingest the documents into. |
region | string | AWS region (default: us-east-1) |
SELECT examples
- get_knowledge_base_documents
- list_knowledge_base_documents
Retrieves specific documents from a data source that is connected to a knowledge base. For more information, see Ingest changes directly into a knowledge base in the Amazon Bedrock User Guide.
SELECT
document_details
FROM aws.bedrock_agent.knowledge_base_documents
WHERE knowledge_base_id = '{{ knowledge_base_id }}' -- required
AND data_source_id = '{{ data_source_id }}' -- required
AND region = '{{ region }}' -- required
;
Retrieves all the documents contained in a data source that is connected to a knowledge base. For more information, see Ingest changes directly into a knowledge base in the Amazon Bedrock User Guide.
SELECT
data_source_id,
identifier,
knowledge_base_id,
status,
status_reason,
updated_at
FROM aws.bedrock_agent.knowledge_base_documents
WHERE knowledge_base_id = '{{ knowledge_base_id }}' -- required
AND data_source_id = '{{ data_source_id }}' -- required
AND region = '{{ region }}' -- required
;
DELETE examples
- delete_knowledge_base_documents
Deletes documents from a data source and syncs the changes to the knowledge base that is connected to it. For more information, see Ingest changes directly into a knowledge base in the Amazon Bedrock User Guide.
DELETE FROM aws.bedrock_agent.knowledge_base_documents
WHERE knowledge_base_id = '{{ knowledge_base_id }}' --required
AND data_source_id = '{{ data_source_id }}' --required
AND region = '{{ region }}' --required
;
Lifecycle Methods
- ingest_knowledge_base_documents
Ingests documents directly into the knowledge base that is connected to the data source. The dataSourceType specified in the content for each document must match the type of the data source that you specify in the header. For more information, see Ingest changes directly into a knowledge base in the Amazon Bedrock User Guide.
EXEC aws.bedrock_agent.knowledge_base_documents.ingest_knowledge_base_documents
@knowledge_base_id='{{ knowledge_base_id }}' --required,
@data_source_id='{{ data_source_id }}' --required,
@region='{{ region }}' --required
@@json=
'{
"clientToken": "{{ clientToken }}",
"documents": "{{ documents }}"
}'
;