Interface: LoadOptions
Defined in: indexes/search-index.ts:47
Options for loading data into an index.
Properties
batchSize?
optionalbatchSize?:number
Defined in: indexes/search-index.ts:71
Number of objects to write in a single Redis pipeline execution.
Default
200
idField?
optionalidField?:string
Defined in: indexes/search-index.ts:53
Field name to use as the document ID. If provided, the value of this field will be used as the key. If not provided, keys will be auto-generated.
keys?
optionalkeys?:string[]
Defined in: indexes/search-index.ts:59
Explicit keys to use for the documents. Must match the length of the data array.
preprocess?
optionalpreprocess?: (doc) =>Promise<Record<string,unknown>>
Defined in: indexes/search-index.ts:93
Preprocessing function to transform documents before loading. The function receives a document and returns a Promise of the transformed document.
Parameters
doc
Record<string, unknown>
Returns
Promise<Record<string, unknown>>
Example
// Simple transformation
await index.load(data, {
preprocess: async (doc) => ({ ...doc, timestamp: Date.now() })
});
// generating embeddings
await index.load(data, {
preprocess: async (doc) => ({
...doc,
embedding: await vectorizer.embed(doc.text)
})
});
ttl?
optionalttl?:number
Defined in: indexes/search-index.ts:65
Time-to-live in seconds for the documents. If provided, documents will expire after this duration.
validateOnLoad?
optionalvalidateOnLoad?:boolean
Defined in: indexes/search-index.ts:99
Whether to validate documents against schema before loading.
Default
false