meili, the Meilisearch command line tool. meili works with Meilisearch Cloud projects and with self-hosted instances.
Prerequisites
- A Meilisearch instance (Cloud or self-hosted)
- Node.js 22 or later, only if you install the CLI with npm
1. Install the CLI
- npm
- Homebrew
- Install script
2. Connect to Meilisearch
The CLI stores your projects in a config file,~/.config/meili/config.json by default. Each project has a name, a URL, and an API key.
- Meilisearch Cloud
- Self-hosted
Log in to Meilisearch Cloud in your browser, then add your Cloud projects to the config file:When you are an admin of the project’s team, the CLI also saves the project’s master key. Otherwise, the CLI saves the project without an API key. Ask an admin of the team for an API key, then add it to the config file:
--project (or -p). Check that the instance is available:
3. Add documents
Create amovies.json file:
movies index (--index or -i):
movies index if it does not exist. Adding documents is an asynchronous operation: without --wait, the CLI prints the task and returns at once. --wait follows the task until indexing is complete, then prints the final task.
4. Search
--json to print the JSON response of Meilisearch instead.
5. Search with filters
First, configure filterable attributes:--q, Meilisearch runs a placeholder search and returns all documents that match the filter, here Interstellar.
Full example
Explore the commands
meili --help lists every command. Add --help to any command to see its flags and examples:
meili schema describes every command as JSON. meili schema --command <name> describes one command in full, with its flags, the Meilisearch routes it calls, and examples. Scripts and AI agents can use it to discover the commands:
Next steps
Full-text search
Configure ranking and relevancy
Filtering
Add filters and facets
AI-powered search
Add semantic search
API reference
Explore all search parameters