Building a RAG Pipeline with Meilisearch: Hybrid Full-Text and Vector Search
Build powerful RAG pipelines with Meilisearch hybrid search. Learn how to combine full-text and vector search for AI applications using Docker.
Why Hybrid Search Matters for RAG
Retrieval-Augmented Generation (RAG) is the backbone of modern AI applications β from chatbots that answer questions about your documents, to intelligent search that understands user intent. The quality of your RAG pipeline depends entirely on the retrieval step. Hybrid search (combining keyword/ε ¨ζ search with semantic vector search) consistently outperforms either approach alone.
Meilisearch brings both worlds together in a single, lightweight, self-hosted engine. With 58k+ GitHub stars, it's one of the most popular search engines that natively supports hybrid search without requiring a separate vector database.
Architecture Overview
A typical RAG pipeline with Meilisearch looks like this:
- Ingestion: Documents β Chunking β Embedding (via any provider) β Index in Meilisearch
- Query: User question β Embedding + keyword query β Hybrid search β Top-K results β LLM context
- Generation: Context + question β LLM β Answer
Setting Up Meilisearch for RAG
First, launch Meilisearch with vector storage enabled:
docker run -d --name meilisearch \
-p 7700:7700 \
-v $(pwd)/meili_data:/meili_data \
-e MEILI_EXPERIMENTAL_ENABLE_VECTORS=1 \
getmeili/meilisearch:latest
Creating a Search Index with Vector Support
Create an index configured for hybrid search:
curl -X POST 'http://localhost:7700/indexes' \
-H 'Content-Type: application/json' \
-d '{
"uid": "knowledge_base",
"primaryKey": "id"
}'
Update the index settings to enable vector search:
curl -X PATCH 'http://localhost:7700/indexes/knowledge_base/settings' \
-H 'Content-Type: application/json' \
-d '{
"embedder": {
"source": "openAi",
"apiKey": "sk-your-key",
"model": "text-embedding-3-small"
},
"searchableAttributes": ["title", "content"],
"filterableAttributes": ["category", "date"]
}'
Indexing Documents with Embeddings
Add documents with their vector embeddings:
curl -X POST 'http://localhost:7700/indexes/knowledge_base/documents' \
-H 'Content-Type: application/json' \
-d '[
{
"id": 1,
"title": "Getting Started with RAG",
"content": "RAG combines retrieval and generation...",
"category": "tutorial",
"_vectors": {
"default": [0.012, -0.034, 0.078, ...]
}
}
]'
Performing Hybrid Search
Query with both semantic and keyword matching:
curl 'http://localhost:7700/indexes/knowledge_base/search?q=how+to+implement+RAG&hybrid=True'
Benefits Over Separate Vector DBs
- Single Stack: One service for both full-text and vector search
- Zero Config: No separate embedding pipeline needed with built-in embedders
- Fast: Sub-50ms response times even at scale
- Self-Hosted: Complete data privacy β no cloud dependency
Conclusion
Meilisearch makes building RAG pipelines dramatically simpler by combining vector and full-text search in one self-hosted package. Whether you're building a documentation chatbot, an e-commerce search, or an enterprise knowledge base, Meilisearch's hybrid search capabilities deliver the best of both worlds with minimal operational overhead.