agentleFS
abdullahkhawerabdullahkhawer/devops-skills/skills/elasticsearch-cli/SKILL.md

elasticsearch-cli

Skill8 starsChanged 7 months agoApache-2.0View on GitHub

Perform Elasticsearch operations using the Elasticsearch HTTP API via curl. Use for querying indices, documents, mappings, and cluster health.

The file

We split this skill into the rules it gives an agent

11 rules. About 0 are common, 7 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use the instance and rules below when constructing all Elasticsearch API commands.

    line 8
  2. Distinctive:

    Update the table below with your Elasticsearch instance URLs and corresponding credential file paths:

    line 12
  3. Distinctive:

    If the target instance is unclear, ask the user before running any command.

    line 19
  4. Very specific:

    All API calls use curl with the API key read from the instance's credential file:

    line 31
  5. Distinctive:

    NEVER target any Elasticsearch instance not listed in the instance table above.

    line 93
  6. Distinctive:

    Update the instance table with your actual Elasticsearch URLs before using this skill.

    line 94
  7. Distinctive:

    NEVER print, display, log, or store the contents of any credential file.

    line 95
  8. Very specific:

    Always read the API key inline with $(cat <CREDENTIAL_FILE>) — never hardcode a credential value in a command.

    line 96
  9. Very specific:

    Always pass -s (silent) to curl and pipe through jq for readable output.

    line 97
  10. Very specific:

    NEVER run DELETE endpoints or _delete_by_query without explicit user instruction — these are irreversible.

    line 98
  11. Distinctive:

    If the required credential file does not exist, inform the user and stop.

    line 100

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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:

EnvironmentBase URLCredential File
Productionhttps://<your-es-prod-url>~/.elasticsearch/prod.token
Staginghttps://<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.

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:

curl -s -H "Authorization: ApiKey $(cat <CREDENTIAL_FILE>)" \
  "<BASE_URL>/<endpoint>" | jq .

Example (production):

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)

EndpointMethodDescription
/_cluster/healthGETShow cluster health status
/_cat/indices?vGETList all indices with stats
/_cat/nodes?vGETList cluster nodes
/_cat/shards?vGETList shard allocation
/<index>/_mappingGETShow field mappings for an index
/<index>/_settingsGETShow index settings
/<index>/_searchGET/POSTSearch documents (query in body)
/<index>/_countGET/POSTCount matching documents
/<index>/_doc/<id>GETGet a document by ID
/_cat/aliases?vGETList index aliases
/_nodes/statsGETShow node-level statistics

Example query

curl -s -H "Authorization: ApiKey $(cat <CREDENTIAL_FILE>)" \
  -H "Content-Type: application/json" \
  -X POST "<BASE_URL>/<index>/_search" \
  -d '{"query": {"match": {"field": "value"}}, "size": 10}' | jq .

Mutating operations (confirm with user before running)

EndpointMethodDescription
/<index>/_doc/<id>PUT/POSTCreate or update a document
/<index>PUTCreate a new index
/<index>/_mappingPUTAdd fields to an index mapping
/<index>/_settingsPUTUpdate index settings
/_aliasesPOSTUpdate index aliases

Never run — requires explicit human approval

EndpointMethodReason
/<index>DELETEIrreversibly deletes the index and all its documents
/<index>/_doc/<id>DELETEIrreversible document deletion
/<index>/_delete_by_queryPOSTBulk-deletes documents matching a query — irreversible
/_cluster/settingsPUTChanges cluster-wide configuration
/<index>/_close / /<index>/_openPOSTChanges index availability cluster-wide

Rules

  • NEVER target any Elasticsearch instance not listed in the instance table above. If a URL references a different host, stop and ask the user to confirm.
  • Update the instance table with your actual Elasticsearch URLs before using this skill.
  • NEVER print, display, log, or store the contents of any credential file.
  • Always read the API key inline with $(cat <CREDENTIAL_FILE>) — never hardcode a credential value in a command.
  • Always pass -s (silent) to curl and pipe through jq for readable output.
  • NEVER run DELETE endpoints or _delete_by_query without explicit user instruction — these are irreversible.
  • For search queries, always set a reasonable size limit — an unbounded query on a large index can return excessive data.
  • If the required credential file does not exist, inform the user and stop. Do not attempt to find or guess the credential.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.