ES CLI

Quick start

Connect to Elasticsearch and run your first commands with the independent, unofficial open-source ES CLI.

1. Configure a connection

The interactive login tests the cluster and saves a named profile:

es login

Or configure a non-interactive session with environment variables:

export ES_URL=https://elasticsearch.example.com:9200
export ES_USERNAME=elastic
export ES_PASSWORD=changeme

2. Inspect the cluster

es cluster health -o json
es cluster stats -o json
es node list -o json
es shard list -o json

3. Inspect indices

es index list --pattern "logs-*" -o json
es index get logs-2026.07 -o json
es index stats logs-2026.07 -o json

4. Search and manage documents

# Match all, with paging and sorting merged into the request
es search query logs-2026.07 --size 20 --sort timestamp:desc -o json

# Index JSON or YAML from a file, then retrieve the document
es document index logs-2026.07 -f document.json --id event-123
es document get logs-2026.07 event-123 -o json

Discovering commands

Every command has -h/--help:

es --help
es index --help
es index create --help

On this page