Meilisearch is the lightning-fast, open-source search engine — typo-tolerant full-text search in <50ms. It's the free alternative to Algolia and Elasticsearch.
Why Meilisearch?
- 50ms search — instant results, even on large datasets
- Typo-tolerant — "javscript" still finds "JavaScript"
- Zero config — works great out of the box
- RESTful API — simple HTTP calls, any language
- Faceted search — filter by categories, price ranges, etc.
- Multi-tenancy — API key-based tenant isolation
- 11MB binary — runs on a Raspberry Pi
Quick Start
# Docker
docker run -d -p 7700:7700 \
-v meili-data:/meili_data \
getmeili/meilisearch:v1.11
# Or binary
curl -L https://install.meilisearch.com | sh
./meilisearch --master-key="YOUR_MASTER_KEY"
Index Documents
import { MeiliSearch } from "meilisearch";
const client = new MeiliSearch({
host: "http://localhost:7700",
apiKey: "YOUR_MASTER_KEY",
});
// Add documents
await client.index("movies").addDocuments([
{ 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 },
{ id: 4, title: "Pulp Fiction", genre: "crime", year: 1994, rating: 8.9 },
{ id: 5, title: "Interstellar", genre: "sci-fi", year: 2014, rating: 8.7 },
]);
Search
// Basic search
const results = await client.index("movies").search("matrx");
// Finds "The Matrix" despite typo!
// With filters
const sciFi = await client.index("movies").search("", {
filter: ["genre = 'sci-fi'", "year > 2000"],
sort: ["rating:desc"],
limit: 10,
});
// Faceted search
const faceted = await client.index("movies").search("", {
facets: ["genre", "year"],
});
// Returns: { genre: { "sci-fi": 3, "action": 1, "crime": 1 }, year: { ... } }
Express.js Search API
import express from "express";
import { MeiliSearch } from "meilisearch";
const app = express();
const meili = new MeiliSearch({ host: "http://localhost:7700", apiKey: "YOUR_KEY" });
app.get("/api/search", async (req, res) => {
const { q, genre, minRating, page = 1, limit = 20 } = req.query;
const filters = [];
if (genre) filters.push(`genre = '${genre}'`);
if (minRating) filters.push(`rating >= ${minRating}`);
const results = await meili.index("products").search(q, {
filter: filters,
limit: Number(limit),
offset: (Number(page) - 1) * Number(limit),
attributesToHighlight: ["title", "description"],
});
res.json({
hits: results.hits,
total: results.estimatedTotalHits,
page: Number(page),
processingTimeMs: results.processingTimeMs,
});
});
app.listen(3000);
React Search Component
import { useState, useEffect } from "react";
import { instantMeiliSearch } from "@meilisearch/instant-meilisearch";
import { InstantSearch, SearchBox, Hits, RefinementList } from "react-instantsearch";
const searchClient = instantMeiliSearch("http://localhost:7700", "YOUR_SEARCH_KEY");
function SearchPage() {
return (
<InstantSearch indexName="products" searchClient={searchClient}>
<div className="flex gap-8">
<aside>
<h3>Category</h3>
<RefinementList attribute="category" />
<h3>Brand</h3>
<RefinementList attribute="brand" />
</aside>
<main>
<SearchBox placeholder="Search products..." />
<Hits hitComponent={ProductCard} />
</main>
</div>
</InstantSearch>
);
}
function ProductCard({ hit }) {
return (
<div className="card">
<h2>{hit.name}</h2>
<p>{hit.description}</p>
<span>${hit.price}</span>
</div>
);
}
Meilisearch vs Elasticsearch vs Algolia vs Typesense
| Feature | Meilisearch | Elasticsearch | Algolia | Typesense |
|---|---|---|---|---|
| Speed | <50ms | 50-200ms | <50ms | <50ms |
| Typo tolerance | Built-in | Plugin | Built-in | Built-in |
| Setup | Single binary | JVM cluster | Cloud only | Single binary |
| Memory | ~100MB | 2GB+ (JVM) | N/A | ~100MB |
| Cost | Free (OSS) | Free (OSS) | $$$$ | Free (OSS) |
| InstantSearch | Yes | Yes | Yes | Yes |
| Facets | Yes | Yes | Yes | Yes |
| Multi-tenancy | API keys | Indices | API keys | API keys |
Need to scrape data from any website and get it in structured JSON? Check out my web scraping tools on Apify — no coding required, results in minutes.
Have a custom data extraction project? Email me at spinov001@gmail.com — I build tailored scraping solutions for businesses.
Top comments (0)