TL;DR
Meilisearch is an open-source search engine that's fast (50ms searches), typo-tolerant, and requires zero configuration. It's the easiest way to add search to your app — Algolia-quality results, self-hosted and free.
What Is Meilisearch?
Meilisearch makes search simple:
- 50ms response times — instant search-as-you-type
- Typo-tolerant — finds results even with spelling mistakes
- Zero config — smart defaults, works out of the box
- Faceted search — filter by categories, price ranges, etc.
- Multi-language — tokenizes Chinese, Japanese, Korean, Hebrew, etc.
- RESTful API — simple HTTP endpoints
- Free — MIT license, or Meilisearch Cloud free tier
Quick Start
# Docker
docker run -p 7700:7700 getmeili/meilisearch:latest
# Or curl install
curl -L https://install.meilisearch.com | sh
./meilisearch --master-key="YOUR_KEY"
Index Documents
# Add documents via API
curl -X POST 'http://localhost:7700/indexes/movies/documents' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer YOUR_KEY' \
--data-binary '[
{"id": 1, "title": "The Matrix", "genre": "sci-fi", "year": 1999, "rating": 8.7},
{"id": 2, "title": "Inception", "genre": "sci-fi", "year": 2010, "rating": 8.8},
{"id": 3, "title": "The Dark Knight", "genre": "action", "year": 2008, "rating": 9.0}
]'
Search
# Instant search
curl 'http://localhost:7700/indexes/movies/search' \
-H 'Authorization: Bearer YOUR_KEY' \
-d '{"q": "matrix"}'
# Typo-tolerant: "matix" still finds "The Matrix"!
curl 'http://localhost:7700/indexes/movies/search' \
-d '{"q": "matix"}'
JavaScript SDK
import { MeiliSearch } from "meilisearch";
const client = new MeiliSearch({
host: "http://localhost:7700",
apiKey: "YOUR_KEY",
});
// Index documents
const index = client.index("products");
await index.addDocuments([
{ id: 1, name: "MacBook Pro", category: "laptops", price: 1999 },
{ id: 2, name: "iPhone 15", category: "phones", price: 999 },
{ id: 3, name: "AirPods Pro", category: "audio", price: 249 },
]);
// Search
const results = await index.search("macbok"); // typo-tolerant!
console.log(results.hits); // [{ name: "MacBook Pro", ... }]
// Search with filters
const filtered = await index.search("apple", {
filter: ["price < 1000", "category = phones"],
sort: ["price:asc"],
limit: 10,
});
// Faceted search
const faceted = await index.search("", {
facets: ["category", "brand"],
});
console.log(faceted.facetDistribution);
// { category: { laptops: 5, phones: 12, audio: 8 }, brand: { ... } }
React Integration
import { InstantSearch, SearchBox, Hits } from "react-instantsearch";
import { instantMeiliSearch } from "@meilisearch/instant-meilisearch";
const { searchClient } = instantMeiliSearch(
"http://localhost:7700",
"YOUR_SEARCH_KEY"
);
function App() {
return (
<InstantSearch indexName="products" searchClient={searchClient}>
<SearchBox />
<Hits hitComponent={Hit} />
</InstantSearch>
);
}
function Hit({ hit }) {
return (
<div>
<h3>{hit.name}</h3>
<p>${hit.price}</p>
</div>
);
}
Settings
// Configure searchable and filterable attributes
await index.updateSettings({
searchableAttributes: ["name", "description", "category"],
filterableAttributes: ["price", "category", "brand", "inStock"],
sortableAttributes: ["price", "rating", "createdAt"],
rankingRules: [
"words", "typo", "proximity", "attribute", "sort", "exactness",
],
synonyms: {
phone: ["smartphone", "mobile", "cell"],
laptop: ["notebook", "computer"],
},
});
Meilisearch vs Alternatives
| Feature | Meilisearch | Algolia | Elasticsearch | Typesense |
|---|---|---|---|---|
| Free tier | Self-host / Cloud | 10K searches | Self-host | Self-host / Cloud |
| Setup time | 1 minute | 5 min | 30+ min | 5 min |
| Typo tolerance | Built-in | Built-in | Plugin | Built-in |
| Latency | <50ms | <50ms | 100-500ms | <50ms |
| Faceted search | Yes | Yes | Yes | Yes |
| Config needed | Zero | Minimal | Heavy | Minimal |
| Language | Rust | N/A | Java | C++ |
Resources
- Meilisearch Docs
- GitHub Repository — 48K+ stars
- Meilisearch Cloud — free tier
- JavaScript SDK
Building a search engine over web data? My Apify scraping tools extract structured data from any website — index it in Meilisearch for instant search. Questions? Email spinov001@gmail.com
Top comments (0)