A modern, flexible command-line interface (CLI) for interacting with Elasticsearch clusters, written in Rust. This project aims to provide a comprehensive and user-friendly tool for managing and querying Elasticsearch, supporting a wide range of Elasticsearch APIs and features.
- Full CLI for Elasticsearch APIs
- Auto-completion and shell integration
- Secure authentication (API key, username/password, etc.)
- Support for multiple Elasticsearch versions
- Extensible command structure
You can configure escli using a .env file in your project root or working directory. This allows you to securely manage credentials and connection settings without exposing them on the command line.
Supported variables:
ESCLI_URL– Elasticsearch endpoint (e.g., https://localhost:9200)ESCLI_API_KEY– API key for authentication (recommended)ESCLI_USERNAME– Username for authentication (alternative)ESCLI_PASSWORD– Password for authentication (alternative)
Example .env using API key (recommended):
ESCLI_URL=https://localhost:9200
ESCLI_API_KEY=your_api_key_hereExample .env using username and password:
ESCLI_URL=https://localhost:9200
ESCLI_USERNAME=elastic
ESCLI_PASSWORD=yourpasswordTip: If your .env file is not being picked up, ensure you are running escli from the directory containing the .env file, or that your shell environment is loading it.
Use --help to see available commands and options, -h for the short version.
./escli info./escli bulk --input payload.json./escli search --index my_index <<< '{"query": {"match_all": {}}}'./escli esql query --format txt <<< '{"query": "FROM <index> | LIMIT 1"}'./escli utils dump <index>- Rust (latest stable or nightly)
- Elasticsearch cluster (local or remote)
cargo run -p generator --release
cargo build -p escli --release./escli --helpTo enable completions, run and then source the output in your shell:
COMPLETE=<shell> ./escliescli/- Main CLI applicationgenerator/- Code generation utilities for CLI and API bindings
- Contributions are welcome! Please open issues or pull requests.
- See each crate's README or source for more details.
This project is licensed under the Apache 2.0 License. See LICENSE for details.