RAG (Files & Search)
RAG (Files & Search)
Upload, embedding, and search problems — expired URLs, not-ready files, and empty results.
RAG is a three-step flow — upload → embed → search — and most issues come from acting before a step finishes. See RAG for the full guide.
Upload ‘works’ but the file is empty / not searchable
Uploading is two calls: POST /v1/files registers the file and returns a
signed_url; you then PUT the actual bytes to that URL.
- If you skip the PUT (or it failed), the file exists but has no content.
- The PUT goes to storage directly — don’t send your
Authorizationheader on it.
‘signed_url’ rejected / expired
The signed_url expires within a few minutes. PUT your bytes immediately
after registering the file. If it expired, register the file again to get a
fresh URL.
Search returns nothing right after upload
Embedding is asynchronous. A file is only searchable once
embedding_status is ready.
- Poll
GET /v1/files/{file_id}untilembedding_statusisready(it movespending → queued → processing → ready). - If it’s
failed, re-trigger withPOST /v1/files/embed(pass"wait": trueto block for small files). - If
embed: falsewas set at upload, embedding never started — trigger it manually.
Search returns irrelevant or too few results
- Raise
top_k(1–50, default 5). - An over-restrictive
filter(metadata is exact match) ordate_from/date_towindow can exclude everything — loosen them. - A too-narrow
file_idslist restricts search to those files only; omit it to search all your files. - Metadata filters only match keys you set at upload time.
422 on upload
Check required fields on POST /v1/files — file_name and mime_type (e.g.
application/pdf, text/plain, text/markdown). The mime_type also drives
file-type detection.
Still stuck?
See the Mesh API error reference or email contact@meshapi.ai.