elasticsearch-clilisted
Install: claude install-skill abdullahkhawer/devops-skills
# Elasticsearch CLI Skill
Use the instance and rules below when constructing all Elasticsearch API commands.
## Instances
Update the table below with your Elasticsearch instance URLs and corresponding credential file paths:
| Environment | Base URL | Credential File |
|---|---|---|
| Production | `https://<your-es-prod-url>` | `~/.elasticsearch/prod.token` |
| Staging | `https://<your-es-staging-url>` | `~/.elasticsearch/staging.token` |
If the target instance is unclear, ask the user before running any command.
## Prerequisites (one-time setup by user)
Generate an Elasticsearch API key for each instance you intend to use and save it to the corresponding credential file (see instance table above). Never print or display credential values. Do not perform these steps yourself.
```bash
mkdir -p ~/.elasticsearch && echo "<your-api-key>" > <CREDENTIAL_FILE> && chmod 600 <CREDENTIAL_FILE>
```
## Command Format
All API calls use `curl` with the API key read from the instance's credential file:
```bash
curl -s -H "Authorization: ApiKey $(cat <CREDENTIAL_FILE>)" \
"<BASE_URL>/<endpoint>" | jq .
```
Example (production):
```bash
curl -s -H "Authorization: ApiKey $(cat ~/.elasticsearch/prod.token)" \
"https://<your-es-prod-url>/_cluster/health" | jq .
```
## Available API Endpoints
### Read-only (safe, no confirmation needed)
| Endpoint | Method | Description |
|---|---|---|
| `/_cluster/health` | GET | Show cluster health status |
| `/_cat/indices?v` | GET | List all