Set up Meilisearch for fast typo-tolerant search
✓Works with OpenClaudeYou are a backend developer setting up Meilisearch. The user wants to install, configure, and index data in Meilisearch for fast typo-tolerant search.
What to check first
- Ensure you have Docker installed (
docker --version) or download from meilisearch.com/downloads for your OS - Verify Node.js is installed (
node --version) if using the JavaScript SDK - Check that port 7700 is available (
lsof -i :7700on macOS/Linux ornetstat -ano | findstr :7700on Windows)
Steps
- Start Meilisearch server using Docker with
docker run -it --rm -p 7700:7700 getmeili/meilisearch:latest meilisearch --master-key=your-master-key - Install the Meilisearch JavaScript client:
npm install meilisearch - Create a Meilisearch client instance pointing to
http://localhost:7700with your master key - Create an index by calling
client.createIndex('books')with a unique indexUid - Configure typo tolerance by setting
typoTolerancesettings on the index to enable it and setmaxDiatonesandminWordSizeForTypos - Add documents to the index using
index.addDocuments()with an array of objects containingidand searchable fields - Wait for the task to complete by checking the task status returned from document addition
- Test search with
index.search('query')to verify typo tolerance works
Code
import { MeiliSearch } from 'meilisearch';
const client = new MeiliSearch({
host: 'http://localhost:7700',
apiKey: 'your-master-key',
});
async function setupMeilisearch() {
try {
// Create index
const indexUid = 'books';
const index = await client.createIndex(indexUid, { primaryKey: 'id' });
console.log('Index created:', index);
// Configure typo tolerance
await index.updateSettings({
typoTolerance: {
enabled: true,
minWordSizeForTypos: {
oneTypo: 5,
twoTypos: 9,
},
},
searchableAttributes: ['title', 'author', 'description'],
displayedAttributes: ['id', 'title', 'author', 'year'],
});
// Add documents
const documents = [
{ id: 1, title: 'The Great Gatsby', author: 'F. Scott Fitzgerald', year: 1925 },
{ id: 2, title: '1984', author: 'George Orwell', year: 1949 },
{ id: 3, title: 'To Kill a Mockingbird', author: '
Note: this example was truncated in the source. See the GitHub repo for the latest full version.
Common Pitfalls
- Treating this skill as a one-shot solution — most workflows need iteration and verification
- Skipping the verification steps — you don't know it worked until you measure
- Applying this skill without understanding the underlying problem — read the related docs first
When NOT to Use This Skill
- When a simpler manual approach would take less than 10 minutes
- On critical production systems without testing in staging first
- When you don't have permission or authorization to make these changes
How to Verify It Worked
- Run the verification steps documented above
- Compare the output against your expected baseline
- Check logs for any warnings or errors — silent failures are the worst kind
Production Considerations
- Test in staging before deploying to production
- Have a rollback plan — every change should be reversible
- Monitor the affected systems for at least 24 hours after the change
Related Search Skills
Other Claude Code skills in the same category — free to download.
Elasticsearch Setup
Set up Elasticsearch with indexing and full-text search
Algolia Setup
Integrate Algolia instant search with facets and filters
Postgres Full-Text
Implement full-text search with PostgreSQL tsvector
Search Autocomplete
Build search autocomplete with debounce and suggestions
Search Analytics
Track search queries and click-through for relevance tuning
Elasticsearch Index Mapping
Design Elasticsearch mappings that make queries fast and storage efficient
Want a Search skill personalized to YOUR project?
This is a generic skill that works for everyone. Our AI can generate one tailored to your exact tech stack, naming conventions, folder structure, and coding patterns — with 3x more detail.