{"id":13783263,"url":"https://github.com/jeromepin/esctl","last_synced_at":"2025-05-11T18:31:33.735Z","repository":{"id":39093101,"uuid":"215721023","full_name":"jeromepin/esctl","owner":"jeromepin","description":"Easy to use CLI tool to manage Elasticsearch, preventing long curl commands.","archived":false,"fork":false,"pushed_at":"2024-12-20T08:41:11.000Z","size":291,"stargazers_count":39,"open_issues_count":11,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-06T23:03:40.057Z","etag":null,"topics":["cli","elasticsearch"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jeromepin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-10-17T06:39:31.000Z","updated_at":"2025-04-09T20:36:25.000Z","dependencies_parsed_at":"2023-01-30T20:00:39.572Z","dependency_job_id":"f35c4b03-c334-4cf0-b2da-f88fe7b2a0b0","html_url":"https://github.com/jeromepin/esctl","commit_stats":{"total_commits":91,"total_committers":1,"mean_commits":91.0,"dds":0.0,"last_synced_commit":"a6893b63500ca978c2232c9e2e482e96708441ae"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeromepin%2Fesctl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeromepin%2Fesctl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeromepin%2Fesctl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeromepin%2Fesctl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jeromepin","download_url":"https://codeload.github.com/jeromepin/esctl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253613296,"owners_count":21936249,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","elasticsearch"],"created_at":"2024-08-03T19:00:17.445Z","updated_at":"2025-05-11T18:31:33.374Z","avatar_url":"https://github.com/jeromepin.png","language":"Python","funding_links":[],"categories":["Elasticsearch developer tools and utilities"],"sub_categories":["Management"],"readme":"\u003ch1 align=\"center\"\u003e\n  \u003cbr/\u003e\n  Esctl\n  \u003cbr/\u003e\n\u003c/h1\u003e\n\n\u003ch4 align=\"center\"\u003eA Command-Line Interface designed to ease Elasticsearch administration.\u003c/h4\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/jeromepin/esctl/actions?query=workflow%3A%22Lint+and+test%22+branch%3Amaster\"\u003e\n    \u003cimg src=\"https://github.com/jeromepin/esctl/workflows/Lint%20and%20test/badge.svg\" alt=\"Test status\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/jeromepin/esctl/actions?query=workflow%3A%22Publish+%F0%9F%93%A6%22+branch%3Amaster\"\u003e\n    \u003cimg src=\"https://github.com/jeromepin/esctl/workflows/Publish%20%F0%9F%93%A6/badge.svg\" alt=\"Publish status\"\u003e\n  \u003c/a\u003e\n\n  \u003ca href=\"https://www.codefactor.io/repository/github/jeromepin/esctl\"\u003e\n      \u003cimg src=\"https://www.codefactor.io/repository/github/jeromepin/esctl/badge\" alt=\"Codefactor grade\"\u003e\n  \u003c/a\u003e\n\n  \u003ca href=\"https://sonarcloud.io/dashboard?id=jeromepin_esctl\"\u003e\n    \u003cimg src=\"https://sonarcloud.io/api/project_badges/measure?project=jeromepin_esctl\u0026metric=alert_status\" alt=\"Code quality status\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"#key-features\"\u003eKey Features\u003c/a\u003e •\n  \u003ca href=\"#installation\"\u003eInstallation\u003c/a\u003e •\n  \u003ca href=\"#how-to-use\"\u003eHow To Use\u003c/a\u003e •\n  \u003ca href=\"#examples\"\u003eExamples\u003c/a\u003e •\n  \u003ca href=\"#license\"\u003eLicense\u003c/a\u003e •\n  \u003ca href=\"#developing\"\u003eDeveloping\u003c/a\u003e\n\u003c/p\u003e\n\n\u003chr/\u003e\n\nEsctl is a CLI tool for Elasticsearch. [I designed it](https://jeromepin.fr/posts/esctl-managing-elasticsearch-from-command-line/) to shorten huge `curl` commands Elasticsearch operators were running like :\n\n```bash\ncurl -XPUT --user \"john:doe\" 'http://elasticsearch.example.com:9200/_cluster/settings' -d '{\n    \"transient\" : {\n        \"cluster.routing.allocation.enable\": \"NONE\"\n    }\n}'\n```\n\nThe equivalent with `esctl` is\n\n```bash\nesctl cluster routing allocation enable none\n```\n\n## Key Features\n\n* **Easy to use CLI** rather than long curl commands (thanks to [cliff](https://github.com/openstack/cliff))\n* Cluster-level informations : **stats**, **info**, **health**, **allocation explanation**\n* Node-level informations : **list**, **hot threads**, **exclusion**, **stats**\n* Cluster-level and index-level **settings**\n* `_cat` API for **allocation**, **plugins** and **thread pools**\n* **Index management** : open, close, create, delete, list\n* `raw` command to perform raw HTTP calls when esctl doesn't provide a nice interface for a given route.\n* Per-module **log configuration**\n* X-Pack APIs : **users** and **roles**\n* **Multiple output formats** : table, csv, json, value, yaml\n* [JMESPath](https://jmespath.org/) queries using the `--jmespath` flag\n* Colored output !\n* Run arbitrary pre-commands before issuing the call to Elasticsearch (like running `kubectl port-forward` for example)\n* Fetch cluster's credentials from external commands instead of having them shown in cleartext in the config file\n\n\n## Installation\n\n### Using PIP\n\n```bash\npip install esctl\n```\n\n### From source\n\n```bash\npip install git+https://github.com/jeromepin/esctl.git\n```\n\n\n## How To Use\n\nEsctl relies on a `~/.esctlrc` file containing its config. This file is automatically created on the first start if it doesn't exists :\n\n```yaml\nclusters:\n  bar:\n    servers:\n      - https://bar.example.com\n\nusers:\n  john-doe:\n    username: john\n    external_password:\n      command:\n        run: kubectl --context=bar --namespace=baz get secrets -o json my-secret | jq -r '.data.password||@base64d'\n\ncontexts:\n  foo:\n    user: john-doe\n    cluster: bar\n\ndefault-context: foo\n```\n\n### Running pre-commands\n\nSometimes, you need to execute a shell command right before running the `esctl` command. Like running a `kubectl port-forward` in order to connect to your Kubernetes cluster.\nThere is a `pre_commands` block inside the context which can take care of that :\n\n```yaml\nclusters:\n  remote-kubernetes:\n    servers:\n    - http://localhost:9200\ncontexts:\n  my-distant-cluster:\n    cluster: remote-kubernetes\n    pre_commands:\n    - command: kubectl --context=my-kubernetes-context --namespace=elasticsearch port-forward svc/elasticsearch 9200\n      wait_for_exit: false\n      wait_for_output: Forwarding from\n    user: john-doe\n```\n\nAlong with `command`, you can pass two options :\n* `wait_for_exit` (_default_: `true`) : wait for the command to exit before continuing. Usually set to `false` when the command is running in the foreground.\n* `wait_for_output` : if `wait_for_exit` is `false`, look for a specific output in the command's stdout. The string to look-for is interpreted as a regular expression passed to Python's [re.compile()](https://docs.python.org/3.7/library/re.html).\n\n\n## Examples\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"node-list-sample.png\" alt=\"node-list sample\"\u003e\n\u003c/p\u003e\n\n\n## License\n\n`esctl` is licensed under the GNU GPLv3. See [LICENCE](https://github.com/jeromepin/esctl/blob/master/LICENSE) file.\n\n## Developing\n\n### Install\n\n```bash\nmake install\n```\n\n### Run tests\n\n```bash\nmake test\n```\n\n### Format and lint code\n\n```bash\nmake lint\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeromepin%2Fesctl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjeromepin%2Fesctl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeromepin%2Fesctl/lists"}