Cohere provides high-quality multilingual embedding models. This guide shows you how to configure Meilisearch with Cohere embeddings using the REST embedder, covering both the v3 and the newer v4 model families.
Requirements
- A Meilisearch project
- A Cohere account with an API key
Available models
Embed v4 (recommended)
| Model | Dimensions |
|---|
embed-v4.0 | 1536 |
Embed v4 is Cohere’s latest model with improved quality and multilingual support. It uses the v2 API endpoint.
Embed v3
| Model | Dimensions |
|---|
embed-english-v3.0 | 1024 |
embed-multilingual-v3.0 | 1024 |
embed-english-light-v3.0 | 384 |
embed-multilingual-light-v3.0 | 384 |
Embed v4 (v2 API)
{
"cohere": {
"source": "rest",
"apiKey": "<COHERE_API_KEY>",
"dimensions": 1536,
"documentTemplate": "A product named '{{doc.name}}': {{doc.description}}",
"url": "https://api.cohere.com/v2/embed",
"request": {
"model": "embed-v4.0",
"texts": ["{{text}}", "{{..}}"],
"input_type": "search_document",
"embedding_types": ["float"]
},
"response": {
"embeddings": {
"float": ["{{embedding}}", "{{..}}"]
}
}
}
}
Embed v3 (v1 API)
{
"cohere": {
"source": "rest",
"apiKey": "<COHERE_API_KEY>",
"dimensions": 1024,
"documentTemplate": "A product named '{{doc.name}}': {{doc.description}}",
"url": "https://api.cohere.com/v1/embed",
"request": {
"model": "embed-english-v3.0",
"texts": ["{{text}}", "{{..}}"],
"input_type": "search_document"
},
"response": {
"embeddings": ["{{embedding}}", "{{..}}"]
}
}
}
The v4 and v3 models use different API endpoints (/v2/embed vs /v1/embed) and different response formats. Make sure the url and response fields match the model family you choose.
Replace <COHERE_API_KEY> with your actual Cohere API key. Adjust dimensions and model to match the model you select.
Send this configuration to Meilisearch by updating your index settings:
curl \
-X PATCH 'MEILISEARCH_URL/indexes/INDEX_NAME/settings' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer MEILISEARCH_KEY' \
--data-binary '{
"embedders": {
"cohere": {
"source": "rest",
"apiKey": "<COHERE_API_KEY>",
"dimensions": 1536,
"documentTemplate": "A product named '\''{{doc.name}}'\'': {{doc.description}}",
"url": "https://api.cohere.com/v2/embed",
"request": {
"model": "embed-v4.0",
"texts": ["{{text}}", "{{..}}"],
"input_type": "search_document",
"embedding_types": ["float"]
},
"response": {
"embeddings": {
"float": ["{{embedding}}", "{{..}}"]
}
}
}
}
}'
Meilisearch handles batching and rate limiting automatically. Monitor the tasks queue to track indexing progress.
Test the search
{
"q": "comfortable shoes for walking",
"hybrid": {
"semanticRatio": 0.5,
"embedder": "cohere"
}
}
Next steps