ES CLI

Agents

Use structured output, safety flags, and non-interactive operation for coding agents with the independent, unofficial open-source ES CLI.

ES CLI is designed to be driven by coding agents as well as humans. It is harness-agnostic and works with any coding agent or agent harness that can run shell commands.

The output contract

  • Add -o json to read commands for machine-readable output; -o yaml is also available.
  • Structured API data is written to stdout. Verbose HTTP logs and background update notices use stderr; several write commands also send status messages there.
  • Do not assume writes always return JSON. Validate them with a follow-up read when your workflow needs a machine-readable result.
  • Non-zero exit status signals failure.

Automation and safety flags

FlagEnvironmentEffect
--read-onlyES_READ_ONLY=trueBlocks Elasticsearch write operations marked as mutating
--no-inputES_NO_INPUT=trueDisables interactive prompts; commands fail instead of prompting
--quietES_QUIET=trueSuppresses informational output where supported
--verboseES_VERBOSE=trueSends verbose HTTP diagnostics to stderr
# Safe, non-interactive inventory for an agent
ES_READ_ONLY=true ES_NO_INPUT=true \
  es index list --pattern "logs-*" -o json

Destructive delete commands accept --confirm to skip confirmation. Supported create commands accept --if-not-exists, and supported delete commands accept --if-exists, for idempotent automation.

--no-input does not approve a destructive action. Supply --confirm when the selected delete command requires confirmation, or it will fail without a prompt.

Configuration via environment

No es login step is needed in CI. For example, use an Elasticsearch API key:

export ES_URL=https://elasticsearch.example.com:9200
export ES_API_KEY_ID=key-id
export ES_API_KEY=key-secret
export ES_NO_INPUT=true
es cluster health -o json

Connection variables also include ES_USERNAME, ES_PASSWORD, ES_TOKEN, ES_CA_CERT, and ES_INSECURE.

Agent skill

A ready-to-use agent guide lives at SKILL.md, with the longer workflow reference in CLAUDE.md.

On this page