What Meilisearch Does
- Instant Search: Sub-50ms search responses even on large datasets
- Typo Tolerance: Automatic handling of typos and misspellings
- Faceted Search: Filter by categories, prices, dates, and custom attributes
- Hybrid Search: Combine keyword search with AI embeddings for semantic understanding
- Synonyms: Define synonyms for better search results
- Ranking Rules: Customizable ranking with business logic
- Multi-Language: Built-in support for 20+ languages including Chinese, Japanese, Arabic
- Geosearch: Search by geographic distance and bounding box
- Index Management: Create, update, and delete indexes with REST API
- API Keys: Granular access control with scoped API keys
Architecture
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Your App │────▶│ Meilisearch │────▶│ Local Disk │
│ (Search UI) │ │ Engine │ │ (LMDB) │
└──────────────┘ │ (Rust) │ └──────────────┘
└──────────────┘Meilisearch is a single binary written in Rust. No external dependencies — just a single process that stores data in an embedded LMDB database.
Self-Hosting
Docker Compose
services:
meilisearch:
image: getmeili/meilisearch:latest
ports:
- "7700:7700"
environment:
MEILI_MASTER_KEY: your-master-key-min-16-chars
MEILI_ENV: production
MEILI_NO_ANALYTICS: "true"
volumes:
- meili-data:/meili_data
restart: unless-stopped
volumes:
meili-data:Basic Usage
1. Create Index and Add Documents
# Add documents to an index
curl -X POST 'http://localhost:7700/indexes/products/documents'
-H "Authorization: Bearer your-master-key"
-H "Content-Type: application/json"
--data-binary '[
{
"id": 1,
"name": "iPhone 15 Pro",
"price": 999,
"brand": "Apple",
"tags": ["phone", "premium"]
},
{
"id": 2,
"name": "Samsung Galaxy S24",
"price": 899,
"brand": "Samsung",
"tags": ["phone", "android"]
}
]'2. Search
# Simple search
curl 'http://localhost:7700/indexes/products/search?q=iphone'
-H "Authorization: Bearer your-master-key"
# Advanced search with filters
curl -X POST 'http://localhost:7700/indexes/products/search'
-H "Authorization: Bearer your-master-key"
-H "Content-Type: application/json"
-d '{
"q": "phone",
"filter": "price < 1000 AND brand = "Apple"",
"sort": ["price:asc"],
"limit": 10,
"attributesToHighlight": ["name"]
}'3. Typo Tolerance in Action
Query: "iphne" → Finds "iPhone" (automatic typo correction)
Query: "samsong" → Finds "Samsung"
Query: "prroducts" → Finds "products"SDK Examples
JavaScript
import { MeiliSearch } from 'meilisearch';
const client = new MeiliSearch({
host: 'http://localhost:7700',
apiKey: 'your-master-key',
});
// Add documents
await client.index('products').addDocuments([
{ id: 1, name: 'iPhone 15', price: 999 },
]);
// Search
const results = await client.index('products').search('iphone', {
limit: 10,
filter: 'price < 1500',
});Python
import meilisearch
client = meilisearch.Client('http://localhost:7700', 'your-master-key')
# Add documents
client.index('products').add_documents([
{'id': 1, 'name': 'iPhone 15', 'price': 999}
])
# Search
results = client.index('products').search('iphone', {
'limit': 10,
'filter': 'price < 1500'
})Key Features
Hybrid Search (AI + Keyword)
{
"q": "comfortable running shoes",
"hybrid": {
"embedder": "openai",
"semanticRatio": 0.5
}
}Combines traditional keyword matching with AI semantic understanding for best results.
Faceted Search
{
"q": "phone",
"facets": ["brand", "price_range", "tags"]
}Response includes facet counts for building filter UIs.
Ranking Rules
{
"rankingRules": [
"words",
"typo",
"proximity",
"attribute",
"sort",
"exactness",
"popularity:desc"
]
}Instant Search UI
Use InstantMeilisearch for React/Vue/vanilla JS:
import { InstantSearch, SearchBox, Hits } from 'react-instantsearch-dom';
import { instantMeiliSearch } from '@meilisearch/instant-meilisearch';
const searchClient = instantMeiliSearch('http://localhost:7700', 'your-key');
function App() {
return (
<InstantSearch indexName="products" searchClient={searchClient}>
<SearchBox />
<Hits hitComponent={ProductHit} />
</InstantSearch>
);
}Meilisearch vs Alternatives
| Feature | Meilisearch | Typesense | Algolia | ElasticSearch |
|---|---|---|---|---|
| Open Source | Yes (MIT) | Yes (GPL) | No | Yes (Elastic/AGPL) |
| Setup | Single binary | Single binary | SaaS | Cluster |
| Typo tolerance | Built-in | Built-in | Built-in | Plugin |
| AI hybrid search | Yes | Yes | Yes | Yes (v8) |
| Faceted search | Yes | Yes | Yes | Yes |
| Geosearch | Yes | Yes | Yes | Yes |
| Language | Rust | C++ | N/A | Java |
| RAM per 1M docs | ~1GB | ~1GB | N/A | ~4GB+ |
| Pricing | Free | Free | $500+/mo | Free (self-host) |
FAQ
Q: What dataset size is Meilisearch suitable for? A: It's suited to small-to-medium datasets (hundreds of thousands to tens of millions of documents). The official recommendation is under 10M documents per instance. For hundred-million-scale data, ElasticSearch or Qdrant is a better fit.
Q: How well does it handle Chinese search? A: Excellent. Meilisearch has built-in Chinese tokenization (jieba) with solid support for Simplified, Traditional, and mixed Chinese-English queries — no extra configuration required.
Q: What's the main difference compared to Algolia? A: Algolia is a paid hosted service; Meilisearch is free and self-hostable. Features are similar and search speed is on par. For cost-sensitive projects, Meilisearch is a perfect alternative.
Sources & Credits
- GitHub: meilisearch/meilisearch — 57K+ ⭐ | MIT
- Website: meilisearch.com