Interact with the Elastic Stack and Elastic Cloud from the command line.
This CLI tool is a technical preview and is still under active development. It does not yet support all features and APIs available in every version of the Elastic stack.
Install globally from npm so the elastic binary is available on your PATH:
npm install -g @elastic/cli
elastic --helpIf you don't want a global install, you can run a one-off invocation with
npx, which downloads and runs the CLI without persisting it:
npx -y @elastic/cli --helpIf
npm install -gfails with anEACCESpermission error on Linux/macOS, either re-run withsudoor (recommended) point npm's global prefix at a user-owned directory:mkdir -p ~/.npm-global npm config set prefix ~/.npm-global echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc source ~/.bashrc
Prefer elastic <command> --help --json for one command and elastic cli-schema
for the full tree. Do not ingest docs/cli/schema.json directly.
elastic config context add local --es-url http://localhost:9200 --es-api-key <api-key>
elastic status
elastic es info
elastic es search --index my-index
elastic cloud hosted deployments list-deployments| Topic | Page |
|---|---|
| Get started | Quickstart |
| Install, update, and uninstall | Install the Elastic CLI |
| Config file, contexts, credentials | Configure the Elastic CLI |
| Config file properties | Configuration file reference |
| Elastic Cloud | Connect to Elastic Cloud |
| Tab completion | Shell completion |
| Extensions | Extend the Elastic CLI |
| Commands and global options | Command reference |