Meilisearch is an open-source search engine with typo tolerance, filters, and facets — and search results come back in <50ms.
Add Documents
import { MeiliSearch } from 'meilisearch'
const client = new MeiliSearch({ host: 'http://localhost:7700', apiKey: 'masterKey' })
// Index documents
await client.index('products').addDocuments([
{ id: 1, name: 'iPhone 15 Pro', category: 'Electronics', price: 999, brand: 'Apple' },
{ id: 2, name: 'Samsung Galaxy S24', category: 'Electronics', price: 799, brand: 'Samsung' },
{ id: 3, name: 'MacBook Air M3', category: 'Laptops', price: 1099, brand: 'Apple' }
])
Search — Instant & Typo-Tolerant
// Basic search (handles typos automatically)
const results = await client.index('products').search('iphon') // finds "iPhone 15 Pro"
// With filters and facets
const results = await client.index('products').search('laptop', {
filter: ['price < 1500', 'brand = Apple'],
facets: ['category', 'brand'],
sort: ['price:asc'],
limit: 10,
attributesToHighlight: ['name']
})
REST API
# Search
curl 'http://localhost:7700/indexes/products/search' \
-H 'Authorization: Bearer masterKey' \
-d '{"q": "laptop", "filter": "price < 1500", "limit": 10}'
# Multi-index search
curl 'http://localhost:7700/multi-search' \
-d '{"queries": [
{"indexUid": "products", "q": "apple"},
{"indexUid": "articles", "q": "apple"}
]}'
Configure Search Behavior
// Set searchable and filterable attributes
await client.index('products').updateSettings({
searchableAttributes: ['name', 'description', 'brand'],
filterableAttributes: ['category', 'brand', 'price'],
sortableAttributes: ['price', 'rating'],
synonyms: {
'phone': ['smartphone', 'mobile'],
'laptop': ['notebook', 'computer']
},
typoTolerance: {
minWordSizeForTypos: { oneTypo: 4, twoTypos: 8 }
}
})
Federated Search (Multi-Index)
const results = await client.multiSearch({
queries: [
{ indexUid: 'products', q: 'apple', limit: 5 },
{ indexUid: 'articles', q: 'apple', limit: 5 },
{ indexUid: 'support', q: 'apple', limit: 3 }
]
})
Real-World Use Case
An e-commerce site was using PostgreSQL LIKE queries for search. "iphone case" returned 0 results because products were listed as "iPhone Case" (case mismatch). "laptob" returned nothing (no typo handling). They added Meilisearch: typo tolerance, instant results, faceted navigation. Search conversion rate jumped from 2% to 8%.
Meilisearch is the search engine that makes you look like you have a data science team.
Build Smarter Data Pipelines
Need to scrape websites, extract APIs, or automate data collection? Check out my ready-to-use scrapers on Apify — no coding required.
Custom scraping solution? Email me at spinov001@gmail.com — fast turnaround, fair prices.
Top comments (0)