When to use composite embedders
A single embedder works well for most projects. Composite embedders are useful when indexing and search have different performance requirements:| Scenario | Indexing embedder | Search embedder |
|---|---|---|
| Cost optimization | Cloud API with batch pricing | Local model (no per-query cost) |
| Latency optimization | REST endpoint (higher throughput, higher latency) | HuggingFace local model (lower latency) |
| Infrastructure split | GPU server for bulk embedding | CPU-based model for real-time queries |
| Rate limit management | Dedicated batch API endpoint | Separate endpoint with its own rate limits |
This guide requires two embedding providers that produce vectors with the same number of dimensions.
Step 1: enable the experimental feature
Activate thecompositeEmbedders flag:
Step 2: configure a composite embedder
Set the embedder source to"composite" and define separate searchEmbedder and indexingEmbedder objects. Each sub-embedder uses the same configuration format as a standard embedder.
- Indexing uses a REST embedder pointing to a high-throughput embedding API. This endpoint can handle large batches of documents efficiently.
- Search uses a local HuggingFace model (
BAAI/bge-base-en-v1.5). Running locally eliminates network latency for real-time search queries.
Step 3: search with the composite embedder
Search works exactly like any other hybrid search. Reference the composite embedder by name:Important constraints
Matching dimensions: both the search embedder and the indexing embedder must produce vectors with the same number of dimensions. If they differ, Meilisearch returns an error when you try to configure the embedder. Compatible models: for coherent search results, both embedders must use the exact same model with the same version and configuration. For example, you can use BGE-M3 hosted locally for indexing and the same BGE-M3 model on Cloudflare Workers AI for search, as long as both use the same model revision. Using different models (for example, an OpenAI model for indexing and a Mistral model for search) will produce poor search quality because the vector spaces will not align, even if dimensions match. Experimental status: this feature requires thecompositeEmbedders experimental flag. The API surface may change in future versions. Monitor the changelog for updates.
Next steps
Choose an embedder
Compare embedding providers and pick the right one for your use case.
Configure a REST embedder
Set up embedders using any provider with a REST API.
Configure a HuggingFace embedder
Run embedding models locally with HuggingFace.