Skip to content

meilisearch/meilisearch-cli

Repository files navigation

Meilisearch CLI

The official Meilisearch CLI — a single Rust binary that covers everything from day-to-day instance management to advanced data operations, with an interactive TUI mode for search, chat, and settings.

Interactive Search Interactive Chat
Interactive search TUI Interactive chat TUI
Settings Overview Settings Editor
Interactive settings overview Interactive settings field editor

Installation

# Quick install (latest release)
curl -fsSL https://raw.githubusercontent.com/meilisearch/meilisearch-cli/main/install.sh | sh

# Install a specific version
curl -fsSL https://raw.githubusercontent.com/meilisearch/meilisearch-cli/main/install.sh | sh -s -- v0.1.0

# Custom install directory
INSTALL_DIR=~/.local/bin curl -fsSL https://raw.githubusercontent.com/meilisearch/meilisearch-cli/main/install.sh | sh

# From source
cargo install --path .

The binary is named msc (short for Meilisearch CLI):

msc --help

Quick Start

# Check server health
msc health

# Create an index and import data
msc index create movies --primary-key id
msc import movies --file movies.json

# Search
msc search movies "gatsby"

# Interactive search TUI
msc search movies -i

Project Management

The CLI supports multiple Meilisearch instances through named projects stored in ~/.config/msc/config.toml.

# Add a remote project
msc project add production --url https://my-instance.meilisearch.io --api-key masterKey123

# Switch default project
msc project use production

# List all projects
msc project list

# Target a specific project for one command
msc --project staging health

Commands

Index Management

msc index list
msc index create <uid> [--primary-key <key>]
msc index get <uid>
msc index delete <uid>
msc index stats <uid>
msc index swap <index-a> <index-b>

Document Management

msc document add <uid> --file <path>
msc document add <uid> < data.json          # stdin
msc document get <uid> <id>
msc document list <uid> [--limit 20]
msc document delete <uid> <id>
msc document delete-all <uid>

Search

msc search <uid> <query> [--filter <expr>] [--facets <...>] [--limit <n>]
msc search <uid> -i                         # interactive TUI

Settings

msc settings get <uid>
msc settings update <uid> --file settings.json
msc settings reset <uid>
msc settings edit <uid>                     # opens $EDITOR
msc settings edit <uid> -i                  # interactive TUI
msc settings edit <uid> synonyms            # edit sub-resource in $EDITOR
msc settings diff <uid>

Tasks

msc task list [--status <status>] [--type <type>]
msc task get <id>
msc task cancel <uids>
msc task delete <uids>
msc task wait <id> [--timeout 60000]
msc task watch <id>

API Keys

msc key list
msc key get <key>
msc key create --actions search --indexes movies
msc key delete <key>

Import

msc import <uid> --file data.json
msc import <uid> --file data.ndjson --batch-size 10485760
msc import <uid> --file data.csv
msc import <uid> < stdin.ndjson

Clone

msc clone <source-uid> <dest-uid>
msc clone <source-uid> <dest-uid> --from production --to staging

Promote

msc promote --from local --to production
msc promote --from local --to staging --indexes products,categories
msc promote --from local --to production --dry-run

Local Instance

msc local start       # Docker preferred, binary fallback
msc local stop
msc local restart
msc local status
msc local logs [-f]
msc local reset       # wipe data, restart fresh
msc local upgrade     # upgrade to latest version

Dumps & Snapshots

msc dump create
msc dump snapshot

Chat

msc chat "What products do you have?"
msc chat -i                                 # interactive TUI

Server Info

msc health
msc version
msc stats

Output Formatting

msc search movies "query"              # pretty-printed JSON
msc --raw search movies "query"        # compact JSON, pipeable
msc --quiet health                     # errors only

Configuration

Config file: ~/.config/msc/config.toml

Migration note: users upgrading from earlier versions (when the binary was named meilisearch) will have their existing config at ~/.config/meilisearch/config.toml automatically migrated to the new location on first run.

default = "local"

[projects.local]
type = "local"
url = "http://127.0.0.1:7700"

[projects.production]
url = "https://my-instance.meilisearch.io"
api_key = "masterKey123"

Development

# Build
cargo build

# Run tests (requires Meilisearch on localhost:7700)
cargo test

# Lint
cargo clippy -- -D warnings
cargo fmt --check

License

MIT

About

The official Meilisearch CLI to manage your search platform from your terminal

Resources

Contributing

Security policy

Stars

Watchers

Forks

Packages