Document Knowledge Bases
Create a MariaDB Cloud AI Retrieval document knowledge base, add documents by upload or from an S3 or GCS bucket, test retrieval, and connect an application through the REST API.
A document knowledge base indexes files so that applications can retrieve passages or generated answers from them. This page shows how to create one, add documents, test it, and call it from an application.

Create a Knowledge Base
In the MariaDB Cloud portal, select AI Retrieval.
Select Create Knowledge Base, or Create Document Knowledge Base on the first-use page. Choose Document Knowledge Base as the type.
Enter a Name. The Description is optional.
Under Cloud Provider & Region, select AWS and a region.
Under Vector Store Configuration, select one of these options:
Use existing service lists the Provisioned and Serverless MariaDB services in the same cloud and region that run MariaDB 11.8 or later.
Auto-provision new service creates a MariaDB Serverless instance for you. Enter a Service Name that starts with a letter and contains only lowercase letters, numbers, and hyphens.
Optionally, open Advanced Options to change the models and the reranker.
Select Create Knowledge Base.

The knowledge base shows the status Provisioning, which usually takes a few minutes. When the status changes to Ready, you can add documents.

Advanced Options
Embedding Model
Converts text into the vectors that semantic search uses.
Generation Model
The default model that generates answers for Retrieve & Generate requests. A request can select a different model.
Reranker
Re-scores the retrieved chunks with a reranking model, at the cost of slightly higher latency. It is on by default. When it is on, reranking applies to every retrieval. When it is off, a request can still turn it on. The reranker is billed per 1,000 queries.
Add Documents
You can add documents in two ways. Upload files from your computer, or connect an Amazon S3 or Google Cloud Storage bucket and sync it.
Upload Files
Open the knowledge base and select Upload Documents.
Drag files into the dialog, or select Browse Files. You can add up to 5 files of these types: PDF, DOCX, PPTX, MD, TXT, HTML, and JSON. Each file can be up to 50 MB.
Select Next.
Choose a Parsing Strategy and a Chunking Strategy. See Parsing and Chunking.
Select Upload.


The files appear in the Documents table. The Status column shows the stage that each document has reached. A document starts as Queued, then moves through download, parsing, chunking, embedding, and storage. It ends as Ingested.
Queued
The document is waiting to be processed.
Download
AI Retrieval is fetching the file.
Ingested
The document is indexed. The Chunks column shows how many chunks it produced.
Retrying
Processing met an error, and AI Retrieval retries the document automatically. A warning icon shows the error message.
The status can lag behind the actual state of a document. See Troubleshooting.
Monitor Ingestion
The Documents table shows the status of each document, and the Chunks column shows how many chunks it produced. For a data source, select View Sync History to see each sync.
To monitor ingestion from an application, register a webhook with the ingestion API. AI Retrieval then notifies your endpoint when a document is ingested and when an ingestion job completes or fails.
Connect a Storage Bucket
A data source connects a bucket to the knowledge base. AI Retrieval reads the documents in the bucket when you sync the data source.
Open the knowledge base and select Add Datasource.
On the Connect step, enter the following values.
FieldDescriptionName
3 to 63 characters. It must start and end with a letter or number, and it can contain letters, numbers, spaces, hyphens, and underscores.
Cloud Provider
AWS for Amazon S3, or Google Cloud for Google Cloud Storage.
Storage Path
The bucket, for example
s3://my_bucket, orgs://my_bucketfor Google Cloud Storage. Thes3://prefix is optional.Prefix
Optional. Limits the scan to objects whose keys begin with this value, for example
documents/2026/. Leave it empty to scan the whole bucket.Access Key ID and Access Key
The credentials of an AWS identity that can read the bucket.
Region
The region of the bucket.
Select Test Connection to check the values.
Select Next, and then choose the parsing and chunking strategies for the data source.
On the Sync step, select Sync to ingest the documents now, or Later.

The credentials need these permissions on the bucket:
s3:ListBucketon the bucket, which Test Connection also uses.s3:GetObjecton the objects that you want to ingest.
For Google Cloud Storage, the dialog asks for a service account key in JSON format instead of access keys.

AI Retrieval does not ingest the documents of a data source automatically. Removing a file from the bucket does not remove its document from the knowledge base, so delete the document in the knowledge base. If you delete a document in the knowledge base while its file is still in the bucket, the next sync ingests the file again. Select Sync Now, or Sync in the data source list, whenever you add files to the bucket. To review earlier syncs, select View Sync History.
Parsing and Chunking Strategies
A parsing strategy controls how AI Retrieval reads a file. A chunking strategy controls how it splits the text for indexing. The defaults are Layout-aware parsing and Structure-aware chunking. For the options, the chunk size and overlap fields, and guidance on choosing, see Parsing and Chunking.
Test a Knowledge Base
Open the knowledge base and select Test.
Select the Retrieve tab, or the Retrieve & Generate tab.
Enter a question, and select Test Query.
The Retrieve tab shows the matching chunks with the file name, the chunk text, and the chunk ID. The Retrieve & Generate tab shows the generated answer, with numbers such as [1] that refer to the chunks it used. The Request & Response panel shows the HTTP request that the portal sent and the response. Select Copy as cURL to reuse the request in a terminal.

The portal highlights the words of your question in the results. The highlighting does not show why a chunk matched.
Open Advanced Options to change how a test runs.
Top K Results
5
The number of chunks to retrieve. The portal accepts 1 to 100.
Retrieval Method
Hybrid
Hybrid, Semantic, or Full text.
Documents
All documents
Limits the search to specific documents.
Temperature
0.3
A value from 0 to 2. Lower values give more focused answers.
Top P
1
A value from 0 to 1. The model considers only the most likely tokens whose probabilities add up to this value.
Max Tokens
8192
A value from 64 to 8192. The maximum length of the generated answer.
Reranker
Knowledge base setting
Reorders the retrieved chunks with a reranking model. The choice applies to this test only.
Rerank Top K
Top K
A value from 1 to 50. The number of chunks to keep after reranking. It appears when the reranker is on.
The Retrieve & Generate tab also has a Generation Model list. Temperature, Top P, Max Tokens, and the model apply only to generated answers.


Connect Your Application
Applications call the knowledge base through a REST API and authenticate with an API key. Send the key as a bearer token in the Authorization header, or in the X-API-Key header.
Create an API Key
In the Connect dialog of the knowledge base, select Manage API keys. You can also open your user profile and expand API Keys.
Select Create New.
Enter a name of up to 60 characters, and select Create.
Copy the key and store it safely. MariaDB Cloud shows the key only once.


An API key belongs to your user account, not to a single knowledge base. To stop a key from working, select Revoke in the actions menu of its row. Select Delete to remove it.
Send a Request
Select Connect on the knowledge base to see its endpoint and examples in cURL, Python, and JavaScript. The endpoint has this form:
…/retrieve-chunks
The most relevant chunks.
…/retrieve-chunks-and-generate
A generated answer with citations.
…/retrieve-chunks-and-generate/stream
The generated answer as a stream of events.
The following request retrieves chunks:
The request body accepts these fields.
query
All
Required. The question, from 1 to 4096 characters.
retrieval_method
All
hybrid (default), semantic, or fulltext.
top_k
All
The number of chunks to retrieve, from 1 to 100. The default is 10.
document_ids
All
Limits the search to these document IDs.
enable_rerank
All
Turns reranking on or off for this request. The default is the knowledge base setting.
rerank_top_k
All
The number of chunks to keep after reranking, from 1 to 50. The default is top_k.
min_similarity
All
A value from 0 to 1. Semantic matches must exceed it. The default is 0.5. Full-text matches ignore it.
llm_provider, llm_model
Generate
The model for this request. The default is the knowledge base setting.
temperature
Generate
A value from 0 to 2. The default is 0.3.
top_p
Generate
A value from 0 to 1. The default is 1.
max_tokens
Generate
A value from 64 to 8192. The default is 8192.
enable_citations
Generate
Returns citations. The default is true.
A retrieve-chunks response contains the chunks array. Each chunk has chunk_id, document_id, chunk_text, chunk_index, score, document_name, file_name, and file_format. The response also reports total_chunks, retrieval_method, and reranking_enabled.
A generate response contains the answer, a citations array, chunks_retrieved, chunks_used, and timings. Each citation has a citation_id that matches a number such as [1] in the answer, the chunk_id, the document_id, the document_name, and a preview of the chunk text.
The stream endpoint sends server-sent events. A token event carries part of the answer. The final event carries the complete answer and the citations. A done event ends the stream, and an error event reports a failure.
If your organization exceeds a request limit, the API returns HTTP status 429.
See Service Quotas for the limits.
Manage Documents
Select the actions menu (⋮) in a document row to view its chunks or delete it. Select Delete All Documents to remove every document from the knowledge base. Use Search by file name to find a document. The search covers only the documents on the current page.
Troubleshooting
A Document Stays Queued or Retrying
A document can stay in Queued or Retrying for a long time. The warning icon next to Retrying shows the error message, which can read Internal processing error. AI Retrieval retries a failed document automatically, up to three times.
Check whether the content is already searchable. Run a query in the Test drawer. The status can lag behind the actual state.
If the document does not reach Ingested, delete it and upload it again.
If you ingest many large documents from a bucket, give the sync time. A file that times out is retried once at the end of the sync, and you can run the sync again.
A vector store on a small Serverless instance can slow ingestion down.
Contact MariaDB Support if the problem continues.
Test Connection Fails
The bucket is not found
The bucket name is wrong, or it does not exist in the region that you selected.
The credentials are not valid
The access key ID or the access key is wrong.
Access is denied
The credentials lack the s3:ListBucket permission on the bucket.
The storage provider cannot be reached
A network problem, or a wrong region.
A Document Produces No Text
Scanned documents are not supported yet. A PDF that contains only images of pages is ingested with 0 chunks, and no error is shown. Use a PDF that contains selectable text. Images inside documents are skipped.
This page is: Copyright © 2026 MariaDB. All rights reserved.
Last updated
Was this helpful?

