Changelog - 2026-11-03
The Typesense connector streams exports, excludes fields and takes a timeout per call
New Feature Behavior Change Breaking ChangeIn one line. Export a collection of any size to disk with streamDocuments, drop fields with excludeFields, and give one export, import or schema call its own timeout.
What changed
streamDocumentsstreams an export. It is an async iterable of NDJSON lines, one document per line without its newline, and memory stays at one chunk and one partial line.exportDocumentsis unchanged: it still returns one string, which fails past the string limit (on Bun a string holds at most 2^31 - 1 characters, about 2 GiB of ASCII text).excludeFieldson export.exportDocumentsandstreamDocumentstakefilterBy,includeFieldsand the newexcludeFields(sent asexclude_fields).search()already tookexcludeFields.timeoutMsper call.exportDocuments,streamDocuments,importDocuments,getCollection,createCollectionandpatchCollectionSchemataketimeoutMs, a positive integer of milliseconds that overridesconnectionTimeoutSeconds(5 s by default) for that call: the wait for the engine's answer and then the longest silence on the connection, not a deadline for the whole transfer. Anything else is refused with a 400 before a request. The connector runs such a call on a second client, becausetypesense-jshas no timeout per call.createClientconnector option. When you give the connector your ownclient, also passcreateClient({ connectionTimeoutSeconds }); a call withtimeoutMsis refused with a 400 without it. Without an injected client the connector builds the call client fromnodes,apiKeyandnumRetries.ITypesenseClientLikehas a new required member.documents()of the client the connector accepts now needsexportStream(options?), which resolves to an async iterable of text or bytes (theReadablethattypesense-jsreturns is one). The realClientalready has it; only a client you wrote yourself, such as a test fake or a wrapper, must add it.- A stream whose reader pauses falls silent. If you import each batch while you read the stream, the import must finish within the stream's
timeoutMs; otherwise write the stream to a file first and import from it. updateByFilterrefuses an emptydocument. It throws a 400 before it calls the engine, which answered an empty patch with a 400 of its own.
Who is affected
- Code that exports a large collection. Use
streamDocuments. - Code that calls
updateByFilterwithdocument: {}. It now throws[updateByFilter] Empty documentwhere the engine's 400 came back through the error mapping. - Code that passes its own
clientto the connector (a test fake, a wrapper). The client stops type-checking untildocuments()hasexportStream; see Breaking changes. - Everyone else. No action needed.
Breaking changes
WARNING
A hand-made ITypesenseClientLike without documents().exportStream fails the typecheck.
Before: the object a fake returns from collections(name).documents():
typescript
const documents = {
export: async () => '',
import: async () => [],
// ...
};After:
typescript
const documents = {
export: async () => '',
import: async () => [],
exportStream: async () => (async function* () {})(), // the NDJSON chunks; none here
// ...
};A call that sets timeoutMs on a connector built with this client also needs createClient (see above).
Details
typescript
const connector = dataSource.getConnector();
const file = Bun.file('products.ndjson').writer();
for await (const line of connector.streamDocuments({
collection: 'products',
excludeFields: ['embedding'],
timeoutMs: 30 * 60 * 1000,
})) {
file.write(`${line}\n`);
}
await file.end();