{"id":20904988,"url":"https://github.com/devopsartfactory/escli","last_synced_at":"2025-05-13T05:30:58.325Z","repository":{"id":49001856,"uuid":"321239705","full_name":"DevopsArtFactory/escli","owner":"DevopsArtFactory","description":null,"archived":false,"fork":false,"pushed_at":"2023-02-17T08:41:10.000Z","size":4637,"stargazers_count":30,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-05-08T10:30:22.410Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DevopsArtFactory.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":"2020-12-14T05:07:29.000Z","updated_at":"2025-05-08T04:06:37.000Z","dependencies_parsed_at":"2024-11-18T13:24:38.222Z","dependency_job_id":"56bde85b-d372-48ca-8671-a4f68b9590ed","html_url":"https://github.com/DevopsArtFactory/escli","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevopsArtFactory%2Fescli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevopsArtFactory%2Fescli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevopsArtFactory%2Fescli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevopsArtFactory%2Fescli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DevopsArtFactory","download_url":"https://codeload.github.com/DevopsArtFactory/escli/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253882807,"owners_count":21978549,"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":[],"created_at":"2024-11-18T13:20:25.268Z","updated_at":"2025-05-13T05:30:58.040Z","avatar_url":"https://github.com/DevopsArtFactory.png","language":"Go","readme":"# escli\n`escli` is a command-line tool for managing elasticsearch cluster. If you want to set number_of_replicas of index, you should do with curl like below example.\n```bash\n$ curl -X PUT \"localhost:9200/my-index-000001/_settings?pretty\" -H 'Content-Type: application/json' -d'\n{\n  \"index\" : {\n    \"number_of_replicas\" : 2\n  }\n}\n'\n```\nBut with escli, you type below command.\n```bash\n$ escli index settings my-index-000001 number_of_replicas 2\n```\n`escli` should be make your elasticsearch experience more powerful.\n\n## Release Note \nRelease Note is [Here](RELEASENOTE.md)\n\n\u003e**WARNING**\n\u003eIf you used escli 0.0.4, you have to change your config file. configuration field `elasticsearch_url` is changed `url`.\n\n[AS-IS]\n```bash\n- profile: localhost\n  elasticsearch_url: http://localhost:9200\n  aws_region: ap-northeast-2\n```\n\n[TO-BE]\n```bash\n- profile: localhost\n  url: http://localhost:9200\n  aws_region: ap-northeast-2\n```\n\n## Installation\n### Required\n- [elasticsearch](https://elastic.co) version 6.0 or higher\n- [opensearch](https://opensearch.org) version 1.0 or higher\n\n### Install escli binary \n\n#### On MAC\n```bash\n$ brew tap devopsartfactory/devopsart\n$ brew update\n$ brew install escli \n``` \n\n#### On Linux\n```bash\n$ curl -Lo escli https://escli.s3.ap-northeast-2.amazonaws.com/escli/releases/latest/escli-linux-amd64\n$ sudo install escli /usr/bin\n```\n\n### initialize escli\nconfiguration of escli is stored at `~/.escli/config.yaml` file.\nfor the first time, there is no configuration so you have to initialize configuration with `escli profiles add`\n```bash\n? Your Profile Name :  localhost\n? Your ElasticSearch or OpenSearch URL :  https://localhost:9200\n? Select your product (elasticsearch or opensearch) :  elasticsearch\n? Your AWS Default Region (If you don't use AWS, type blank) :\n? Your HTTP Username (If you don't use http basic authentication, type blank) :  elastic\n? Your HTTP Password (If you don't use http basic authentication, type blank) :  ********************\n? Your certificateFingerPrint (If you don't use certificate finger print, type blank) :  67c2d588a7a6a50e773d0cc91f83cab7a6c11a19e199f3f075b9b6d873a5992a\n- profile: localhost\n  url: https://localhost:9200\n  product: elasticsearch\n  http_username: elastic\n  http_password: qZzEp0Hc112zYx=Z+xQb\n  certificate_finger_print: 67c2d588a7a6a50e773d0cc91f83cab7a6c11a19e199f3f075b9b6d873a5992a\n\n? Are you sure to add profile to configuration file?  yes\nAdding profile to configuration file is successfully in /Users/alden/.escli/config.yaml\n```\n\n## How to use\n\n### configuration\n| field | description                                                                             |\n| ------|-----------------------------------------------------------------------------------------|\n| profile | name of profile                                                                         |\n| url | url of target system                                                                    |\n| product | product of target system. elasticsearch or opensearch         (default : elasticsearch) |\n| aws_region | aws region that you use                                                                 |\n| http_username | http username of target system. It is needed if you use basic http authentication.      |\n| http_password | http password of target system.                                                         |\n| certificate_fingerprint | certificate fingerprint of target system                                                |\n#### configuration example\n```bash\n- profile: dev-access-log\n  url: https://dev-access-log.ap-northeast-2.es.amazonaws.com\n  product: opensearch\n- profile: prod-access-log\n  url: https://prod-access-log.ap-northeast-2.es.amazonaws.com\n  product: opensearch\n  http_username: elastic\n  http_password: abcdefg\n- profile: localhost\n  url: https://localhost:9200\n  product: elasticsearch\n  http_username: elastic\n  http_password: qZzEp0Hc112zYx=Z+xQb\n  certificate_finger_print: 67c2d588a7a6a50e773d0cc91f83cab7a6c11a19e199f3f075b9b6d873a5992a\n```\n\n### common options\n* `--profile` : you can specify profile from configuration file. if you don't specify `--profile` option, escli use first profile of configuration file.\n* `--config` : you can specify configuration file. if you don't specify `--config` option, escli use `~/.escli/config.yaml` configuration file.\n\n### `profiles` command\nyou can add one more elasticsearch clusters to your configuration file by `profiles` command. and then you can use profile with `--profile` option\n\n#### command list\n| command     | description                                               |\n| ----------- | --------------------------------------------------------- |\n| profiles list | shows profiles.        |\n| profiles add | add profile to configuration file  |\n| profiles remove | remove profile from configuration file    |\n\n#### examples\n\n```bash\n$ escli profiles add\n? Your Profile Name :  localhost\n? Your ElasticSearch or OpenSearch URL :  https://localhost:9200\n? Select your product (elasticsearch or opensearch) :  elasticsearch\n? Your AWS Default Region (If you don't use AWS, type blank) :\n? Your HTTP Username (If you don't use http basic authentication, type blank) :  elastic\n? Your HTTP Password (If you don't use http basic authentication, type blank) :  ********************\n? Your certificateFingerPrint (If you don't use certificate finger print, type blank) :  67c2d588a7a6a50e773d0cc91f83cab7a6c11a19e199f3f075b9b6d873a5992a\n- profile: localhost\n  url: https://localhost:9200\n  product: elasticsearch\n  http_username: elastic\n  http_password: qZzEp0Hc112zYx=Z+xQb\n  certificate_finger_print: 67c2d588a7a6a50e773d0cc91f83cab7a6c11a19e199f3f075b9b6d873a5992a\n\n? Are you sure to add profile to configuration file?  yes\nAdding profile to configuration file is successfully in /Users/alden/.escli/config.yaml\n```\n\n```bash\n$ escli profiles list\nProfile                  : localhost\nURL                      : https://localhost:9200\nProduct                  : elasticsearch\nHTTP Username            : elastic\nHTTP Password            : ************\nCertificate Finger Print : 67c2d588a7a6a50e773d0cc91f83cab7a6c11a19e199f3f075b9b6d873a5992a\n```\n\n```bash\n$ escli cat health --profile log-es\n```\n\n\n### `cat` command\n\n#### command list\n| command     | description                                               |\n| ----------- | --------------------------------------------------------- |\n| cat health  | shows health of cluster. it calls `_cat/health` API       |\n| cat indices | shows information of indices. it calls `_cat/indices` API |\n| cat nodes   | shows information of nodes. it calls `_cat/nodes` API     |\n| cat shards  | shows information of shards. it calls `_cat/shards` API   |\n\n#### available options\n| option        | description                                                      |\n| ------------- | ---------------------------------------------------------------- |\n| troubled-only | shows objects with trouble. such as yellow status or red status  |\n| sort-by       | set sort key.                                                    |\n\n#### examples\n\n```bash\n$ escli cat indices\n\nindex                                                   health  status  pri     rep     store.size\n.kibana_1                                               green   open    1       1          918.1kb\n.kibana_task_manager                                    green   open    1       1           26.5kb\n.monitoring-es-6-2021.01.04                             green   open    1       1           21.2gb\n.monitoring-es-6-2021.01.05                             green   open    1       1           21.7gb\n```\n\n```bash\n$ escli cat indices --troubled-only\nindex                                             health  status  pri     rep     store.size\napplication-log-2020.11.01                        red     open    40      0          202.4gb\napplication-log-2020.11.02                        red     open    40      0          289.8gb\napplication-log-2020.11.03                        red     open    40      0          199.9gb\n```\n\n```bash\n$ escli cat indices --sorted-by store.size:desc\nindex                                        health  status  pri     rep     store.size\napplication-log-2021.01.07                   green   open    100     1            3.3tb\napplication-log-2021.01.04                   green   open    100     1              3tb\napplication-log-2021.01.06                   green   open    100     1            2.9tb\n```\n\n### `snapshot` command\n\n`snapshot` command doesn't support OpenSearch.\n\n#### command list\n| command     | description                                               |\n| ----------- | --------------------------------------------------------- |\n| snapshot list        | shows information of repositories and snapshots. it calls `_cat/snapshot` API. |\n| snapshot archive     | change storage class of snapshots to S3 glacier. it works on AWS only.  |\n| snapshot restore     | change storage class of snapshots to S3 standard and restore snapshot.    |\n| snapshot create        | create snapshot of indices.    |\n\n#### available options\n| option        | description                                                      |\n| ------------- | ---------------------------------------------------------------- |\n| force | do not ask continue. it will be used for automated batch job. (only `archive`, `restore` command) |\n| with-repo | shows snapshots of specified repo (only `list` command) |\n| repo-only | shows only information of repos (only `list` command) |\n\n#### examples\n\n```bash\n$ escli snapshot list --repo-only\nRepository ID : log-archive\nRepository ID : log-archive-standard-ia\nRepository ID : log-archive-standard\n```\n\n```bash\n$ escli snapshot create prod-snapshot snapshots-2021-01-01 result-prod-2021-01-01\nsnapshots-2021-01-01 is created\n```\n\n```bash\n$ escli snapshot archive send-mail-result-prod-snapshot snapshots-2020-12-31 --region us-east-1\nbucket name : result-prod\nbase path : elasticsearch-snapshot-standard\nDownloaded /tmp/index-456 81207 bytes\nindex name : result-prod-2020-12-31\nelasticsearch-snapshot-standard/indices/z8bqmUmAQxy8tuwSsmFEKg/0/__-urzTmmuR8K6s6kpLryZ5g\n? Change Storage Class to GLACIER \n```\n\n- If you use `--force` option to `snapshot arvhice` command, escli doesn't ask you to continue. It makes all archiving job.\n\n### `index` command\n\n#### command list\n| command        | description |\n|----------------| ---------------- |\n| index settings | get or set index settings |\n| index delete   | delete index |\n| index create   | create index |\n| index stats    | show statistics of index |\n\n\n#### examples\n\n```bash\n$ escli index settings prod-2021-01-01 \n{\n  \"prod-2021-01-01\" : {\n    \"settings\" : {\n      \"index\" : {\n        \"creation_date\" : \"1609906432373\",\n        \"number_of_shards\" : \"5\",\n        \"number_of_replicas\" : \"2\",\n        \"uuid\" : \"ha6Y6uiCSfOV_syHJwFCqA\",\n        \"version\" : {\n          \"created\" : \"6080099\"\n        },\n        \"provided_name\" : \"send-mail-result-prod-2021-01-01\"\n      }\n    }\n  }\n}\n```\n\n```bash\n$ escli index settings prod-2021-01-12 number_of_replicas                                                                                                                                                                                               ok  3s \n{\n  \"prod-2021-01-12\" : {\n    \"settings\" : {\n      \"index\" : {\n        \"number_of_replicas\" : \"1\"\n      }\n    }\n  }\n}\n```\n\n```bash\n$ escli index settings send-mail-result-prod-2021-01-12 number_of_replicas 2                                                                                                                                                                                                 ok \n{\n  \"acknowledged\" : true\n}\n```\n\n```bash\n$ escli index stats access_log-2023.02.13 1 --profile=localhost\ntime      \tindex               \t        total shards\t   successful shards\t       failed shards\t       indexing rate\tindexing latency (ms)\t          query rate\t  query latency (ms)\t          fetch rate\t  fetch latency (ms)\n16:08:13  \taccess_log-2023.02.13\t                  12\t                  12\t                   0\t                3182\t                0.13\t                   0\t                0.00\t                   0\t                0.00\n16:08:14  \taccess_log-2023.02.13\t                  12\t                  12\t                   0\t                2348\t                0.09\t                   0\t                0.00\t                   0\t                0.00\n16:08:15  \taccess_log-2023.02.13\t                  12\t                  12\t                   0\t                2466\t                0.12\t                   0\t                0.00\t                   0\t                0.00\n16:08:16  \taccess_log-2023.02.13\t                  12\t                  12\t                   0\t                   0\t                0.00\t                   0\t                0.00\t                   0\t                0.00\n16:08:17  \taccess_log-2023.02.13\t                  12\t                  12\t                   0\t                6046\t                0.14\t                   0\t                0.00\t                   0\t                0.00\n16:08:18  \taccess_log-2023.02.13\t                  12\t                  12\t                   0\t                5056\t                0.17\t                   0\t                0.00\t                   0\t                0.00\n16:08:19  \taccess_log-2023.02.13\t                  12\t                  12\t                   0\t                1286\t                0.10\t                   0\t                0.00\t                   0\t                0.00\n```\n\n### `cluster` command\n\n#### command list\n| command | description |\n| ------- | ----------- |\n| cluster settings | get or set index settings |\n\n#### examples\n\n```bash\n$ escli cluster settings\n{\n  \"persistent\" : {\n    \"cluster\" : {\n      \"routing\" : {\n        \"allocation\" : {\n......\n}\n```\n\n```bash\n$ escli cluster settings persistent indices.recovery.max_bytes_per_sec 50mb\n```\n\n### `diag` command\n\n#### examples\n\n```bash\n$ escli diag\ncheck cluster status...........................[green] 😎\ncheck yellow status indices....................[0] 😎\ncheck red status indices.......................[0] 😎\ncheck number of master nodes...................[3]\ncheck maximum disk used percent of nodes.......[36]\n```\n\n### `stats` command\n\n#### examples\n\n```bash\n$ escli stats 1 --profile=localhost\ntime      \t        total shards\t   successful shards\t       failed shards\t       indexing rate\tindexing latency (ms)\t          query rate\t  query latency (ms)\t          fetch rate\t  fetch latency (ms)\n16:10:32  \t                 204\t                 204\t                   0\t               10591\t                0.47\t                   0\t                0.00\t                   0\t                0.00\n16:10:33  \t                 204\t                 204\t                   0\t                1099\t                8.16\t                   0\t                0.00\t                   0\t                0.00\n16:10:34  \t                 204\t                 204\t                   0\t                3267\t                0.13\t                   0\t                0.00\t                   0\t                0.00\n16:10:35  \t                 204\t                 204\t                   0\t                1869\t                0.13\t                   0\t                0.00\t                   0\t                0.00\n```\n\n## Autocompletion\n* zsh\n```bash\n$ echo \"source \u003c(escli completion zsh)\" \u003e\u003e ~/.zshrc\n$ source  ~/.zshrc\n```\n\n* bash\n```bash\n$ echo \"source \u003c(escli completion bash)\" \u003e\u003e ~/.bash_rc or ~/.bash_profile\n$ source  ~/.bashrc\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevopsartfactory%2Fescli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevopsartfactory%2Fescli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevopsartfactory%2Fescli/lists"}