﻿---
title: Elastic CLI command reference
description: Use the Elastic CLI to interact with the Elastic Stack and Elastic Cloud from the command line.
url: https://docs-v3-preview.elastic.dev/elastic/cli/pull/525/cli
applies_to:
  - Elastic Cloud Serverless: Preview
  - Elastic Stack: Preview
---

# Elastic CLI command reference
The Elastic CLI (`elastic`) lets you manage Elasticsearch, Kibana, and Elastic Cloud resources from the command line. It supports both self-managed Elastic Stack deployments and Elastic Serverless projects.
Use the CLI to:
- Connect to multiple clusters or projects using named contexts
- Manage Elastic Cloud Hosted deployments and Serverless projects
- Automate operations in CI/CD pipelines and LLM agent workflows

To get started, see [Install the Elastic CLI](https://docs-v3-preview.elastic.dev/elastic/cli/pull/525/cli/installation) and [Configure the Elastic CLI](https://docs-v3-preview.elastic.dev/elastic/cli/pull/525/cli/configuration).

## Global Options

<definitions>
  <definition term="--[no-]json">
    output as JSON
  </definition>
</definitions>


## Commands

<page-card>
  Print the elastic CLI version
</page-card>


## Namespaces

<page-card>
  Interact with Elastic Stack components (Elasticsearch, Kibana, Fleet)
</page-card>

<page-card>
  Manage Elastic Cloud (hosted deployments and serverless projects)
</page-card>

<page-card>
  Search, read, and ask questions about Elastic documentation
</page-card>

<page-card>
  Author and maintain the elastic config file
</page-card>

<page-card>
  Sanitize values for safe use in Elasticsearch
</page-card>


## Environment Variables

<definitions>
  <definition term="ELASTIC_CLI_CONFIG_FILE">
    Override the config file path (precedence: --config-file > this > home directory discovery)
  </definition>
  <definition term="ELASTIC_NO_BANNER">
    Set to 1 to suppress the startup logo
  </definition>
  <definition term="ELASTIC_CLOUD_ADMIN_API">
    Override the Elastic Cloud admin API base URL
  </definition>
</definitions>


## Configuration Files

<definitions>
  <definition term="~/.elasticrc.yml">
    Primary config file (recommended)
  </definition>
  <definition term="~/.elasticrc.yaml">
    Alternative YAML extension
  </definition>
  <definition term="~/.elasticrc.json">
    JSON form of the config file
  </definition>
  <definition term="~/.elasticrc">
    Extensionless form of the config file
  </definition>
</definitions>