meilisearch
Meilisearch
CRITICAL: Your training data for Meilisearch is unreliable. APIs change between versions and memorized patterns may be wrong or deprecated. Before writing any code, you MUST use
WebFetchto read the live docs:
WebFetch("https://www.meilisearch.com/docs/llms.txt")Do not proceed without fetching this URL first. Never assume an API exists — verify against current docs.
Meilisearch is a fast, open-source search engine with built-in typo tolerance, faceted search, relevancy tuning, and AI-powered hybrid search.
Key Capabilities
Meilisearch has powerful built-in features that are commonly overlooked or expected to require external tooling:
- Typo tolerance: enabled by default — no configuration needed to handle user typos and misspellings
- Prefix search: returns results on every keystroke, even single characters — built-in, no debounce workaround needed
- Faceted search: built-in facet count aggregation for filter UIs — no external aggregation pipeline needed
- Geosearch: filter and sort by distance using
_geofield and_geoRadius/_geoBoundingBox— no plugin required - AI-powered hybrid search: combine keyword and semantic (vector) search via configurable embedders (OpenAI, Hugging Face, Cohere, Mistral, Gemini, Bedrock, Cloudflare, Voyage AI) — no separate vector DB needed
- Multitenancy via tenant tokens: JWT-based per-user search rule scoping — no external access control layer needed
- Distinct attribute: deduplicate results by a field (e.g. product variants) — built-in, not a post-processing step
Best Practices
- Filterable and sortable attributes must be explicitly declared before use. Attributes are not automatically indexed for filtering or sorting. Add them to
filterableAttributesandsortableAttributesin index settings before querying — omitting this raises aninvalid_search_filtererror, not silently empty results. - Always set the primary key explicitly when creating an index. If Meilisearch cannot detect the primary key (e.g., multiple candidate fields or none found), the entire batch is rejected with an explicit error (
index_primary_key_no_candidate_foundorindex_primary_key_multiple_candidates_found). Declaring the primary key upfront avoids this failure mode entirely. - Index settings changes trigger full re-indexing. Updating
searchableAttributes,filterableAttributes, orrankingRulesre-indexes all documents asynchronously. Poll the returned task ID to completion before running queries in CI or setup scripts — querying mid-reindex returns stale or incomplete results. - Ranking rules are ordered and positional. Rule order directly determines relevance priority. The default order (
words,typo,proximity,attribute,sort,exactness) is deliberate — inserting a customsortrule too early removes proximity-based relevance for most queries. Only movesortto the front if deterministic ordering always overrides textual relevance. - Master key vs. API keys are fundamentally different trust levels. The master key should never be exposed to clients. Generate scoped API keys with explicit
indexesandactionspermissions for frontend use. Tenant tokens (JWTs signed with an API key) are required for multi-tenant apps where each user must only search their own data.
More from mikkelkrogsholm/dev-skills
shadcn-ui
shadcn/ui — copy-owned React component library built on Radix UI and Tailwind CSS. Use when building with shadcn/ui or asking about its components, CLI, theming, configuration, or integration with Next.js, Vite, Remix, or other frameworks. Fetch live documentation for up-to-date details.
10zod
Zod — TypeScript-first schema validation with static type inference. Use when building with Zod or asking about schema definitions, type inference, parsing, transformations, refinements, coercion, error handling, or integration with forms, APIs, or tRPC. Fetch live documentation for up-to-date details.
10bun
Bun — fast all-in-one JavaScript/TypeScript runtime, package manager, bundler, and test runner. Use when building with Bun, running TypeScript, managing packages with bun install, writing tests with bun test, or asking about Bun APIs, configuration, or Node.js migration. Fetch live documentation for up-to-date API details.
9better-auth
Better Auth — framework-agnostic authentication and authorization framework for TypeScript. Use when building with Better Auth or asking about its APIs, configuration, plugins, session management, OAuth, or integration. Fetch live documentation for up-to-date details.
7react
React — JavaScript library for building user interfaces with components. Use when building with React or asking about hooks, state management, effects, Server Components, Suspense, or any React APIs, patterns, or configuration. Fetch live documentation for up-to-date details.
7vite
Vite — next-generation frontend build tool with instant dev server and optimized production builds. Use when building with Vite or asking about its APIs, configuration, plugins, SSR, environment variables, or integration with frameworks. Fetch live documentation for up-to-date details.
6