Skip to main content
This guide walks you through setting up Meilisearch with 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

Check the installation:

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.
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:
List the projects of the config file:
Every command takes the project name with --project (or -p). Check that the instance is available:

3. Add documents

Create a movies.json file:
Add the documents to the movies index (--index or -i):
Meilisearch creates the 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.
The CLI prints the results as a table:
Add --json to print the JSON response of Meilisearch instead.

5. Search with filters

First, configure filterable attributes:
Then search with filters:
Without --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

Resources