Install the Elastic CLI
Elastic Cloud Serverless projects are autoscaled environments, fully managed by Elastic and available on Elastic Cloud. Availability This functionality is in technical preview and is ready for evaluation. Use with caution in production; it is not recommended for mission-critical workloads. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. Specific Support terms apply. Serverless interfaces and procedures might differ from classic Elastic Stack deployments. The Elastic Stack includes Elastic's core products such as Elasticsearch, Kibana, Logstash, and Beats. Availability This functionality is in technical preview and is ready for evaluation. Use with caution in production; it is not recommended for mission-critical workloads. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. Specific Support terms apply. Unless stated otherwise on the page, this functionality is available when your Elastic Stack is deployed on Elastic Cloud Hosted, Elastic Cloud Enterprise, Elastic Cloud on Kubernetes, and self-managed environments. This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes.
Serverless
Preview
Preview
Stack
Preview
Preview
Install the Elastic CLI globally to make the elastic command available from your terminal. For occasional use, you can run the CLI through npx without installing it.
To install the CLI, you need to install Node.js 22.12.0 or later. Node.js includes npm. Run node --version to check your installed version. The Elastic CLI is tested on Linux, macOS, and Windows, and the installation command is the same on every platform.
Install the
elasticbinary to yourPATH:Shell npm install -g @elastic/cliVerify the installation:
Shell elastic --versionThe command prints the installed Elastic CLI version.
If npm reports an EACCES error on Linux or macOS, follow the npm instructions for resolving permissions errors when installing packages globally. Don't rerun the installation with sudo.
To run a one-off command without a permanent install, use npx:
npx -y @elastic/cli --help
The command downloads the package to the npm cache, prints the CLI help, and exits.
Install the latest version and verify the update:
npm install -g @elastic/cli@latest
elastic --version
Remove the global installation:
npm uninstall -g @elastic/cli
This command removes the elastic executable. It doesn't remove your configuration file or credentials stored outside the CLI.
- Follow Get started with the Elastic CLI to connect to Elastic and run your first command.
- Configure the Elastic CLI to connect to your Elasticsearch, Kibana, or Elastic Cloud endpoints.