Documentation Index
Fetch the complete documentation index at: https://www.meilisearch.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
Configure a custom embedder
Configure theembedder index setting, setting its source to userProvided:
Add documents to Meilisearch
Next, use the/documents endpoint to upload vectorized documents. Place vector data in your documents’ _vectors field:
The _vectors field in detail
Meilisearch stores pre-computed embeddings under the reserved _vectors field of a document. The field is an object whose keys match the names of the embedders configured in your index settings.
Full object form: embeddings + regenerate
Each embedder entry accepts two fields, embeddings and regenerate:
embeddingsis optional. It must be an array of numbers representing a single embedding for that document. It may also be an array of arrays of numbers, representing multiple embeddings for the same document.embeddingsdefaults tonull.regenerateis mandatory and must be a boolean. Ifregenerateistrue, Meilisearch automatically generates embeddings for that document immediately and every time the document is updated. Ifregenerateisfalse, Meilisearch keeps the last value ofembeddingson document updates and never overwrites it.
Array shorthand
You may also use an array shorthand to add embeddings to a document:Null or empty embedder entries
If the key for an embedder inside_vectors is empty or null, Meilisearch treats the document as not having any embeddings for that embedder. This document is then returned last during AI-powered searches.
Vector search with user-provided embeddings
When using a custom embedder, you must vectorize both your documents and user queries. Once you have the query’s vector, pass it to thevector search parameter to perform an AI-powered search:
vector must be an array of numbers indicating the search vector. You must generate these yourself when using vector search with user-provided embeddings.
vector is mandatory when performing searches with userProvided embedders. You may also use vector with automatic embedders to override an embedder’s automatic vector generation, for example to experiment with a custom-generated query vector without changing your embedder configuration.vector can be used together with other search parameters, including filter and sort:
Return stored vectors with retrieveVectors
Set retrieveVectors: true on a search request to return document and query embeddings alongside the search results. When enabled, Meilisearch displays vector data in each document’s _vectors field.