{"id":13647685,"url":"https://github.com/cyborgize/es-cli","last_synced_at":"2025-04-22T02:32:31.276Z","repository":{"id":43124092,"uuid":"100714407","full_name":"cyborgize/es-cli","owner":"cyborgize","description":"Command-line client for Elasticsearch written in OCaml","archived":false,"fork":false,"pushed_at":"2023-05-02T01:13:56.000Z","size":288,"stargazers_count":32,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-08-03T01:37:49.330Z","etag":null,"topics":["cli","elasticsearch","es-cli","ocaml","terminal"],"latest_commit_sha":null,"homepage":"","language":"OCaml","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/cyborgize.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2017-08-18T13:26:41.000Z","updated_at":"2024-03-11T03:47:59.000Z","dependencies_parsed_at":"2024-01-14T10:40:02.358Z","dependency_job_id":null,"html_url":"https://github.com/cyborgize/es-cli","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyborgize%2Fes-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyborgize%2Fes-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyborgize%2Fes-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyborgize%2Fes-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cyborgize","download_url":"https://codeload.github.com/cyborgize/es-cli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223887806,"owners_count":17219995,"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","es-cli","ocaml","terminal"],"created_at":"2024-08-02T01:03:42.560Z","updated_at":"2024-11-09T21:31:16.588Z","avatar_url":"https://github.com/cyborgize.png","language":"OCaml","funding_links":[],"categories":["OCaml"],"sub_categories":[],"readme":"# elasticsearch-cli — Command-line client for Elasticsearch\n\nThis project provides a command line tool to query ElasticSearch clusters.\n\n## Installation\nelasticsearch-cli can be installed with `opam`:\n\n    opam install elasticsearch-cli\n\n## Getting help\n\n### Show known commands\n```\nes --help\n```\nor just\n```\nes\n```\n\n### Show man page for a command\n```\nes \u003ccommand\u003e --help\n```\nfor example:\n```\nes search --help\n```\n\n## Configuration file\n\nThe tool will look for a configuration file `$XDG_HOME_CONFIG/es-cli/config.json` when started\n(`$XDG_HOME_CONFIG` will be usually `~/.config`; see [XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/basedir-spec-0.6.html) for more details).\n\n## Cluster aliases\n\nIt is possible to use alias names instead of full host names.\n\n```\n{\n  \"clusters\": {\n    \"cluster1\": {\n      \"host\": \"http://cluster1.mydomain.com:9200\"\n    },\n    \"cluster2\": {\n      \"host\": \"http://cluster2.mydomain.com:9200\",\n      \"nodes\": [\n        \"master\",\n        \"data{0..9}\",\n        \"client{0..4}\"\n      ]\n    }\n  }\n}\n```\n\n### show health for cluster1.mydomain.com\n```\nes health cluster1\n```\n\n### show health for all configured clusters\n```\nes health\n```\n\n### search in cluster2.mydomain.com\n```\nes search cluster2 myindex\n```\n\n### find missing nodes in cluster2\n```\nes nodes cluster2\n```\nNote this command relies on the `nodes` parameter in the configuration file.\n\n## Command aliases\n\n```\n{\n  \"aliases\": {\n    \"pause\": {\n      \"command\": \"settings\",\n      \"args\": [ \"-p\", \"cluster.routing.allocation.enable=none\" ]\n    },\n    \"resume\": {\n      \"command\": \"settings\",\n      \"args\": [ \"-p\", \"cluster.routing.allocation.enable=all\" ]\n    }\n  }\n}\n```\n\n### Pause shard allocation\n```\nes pause cluster1\n```\n\n### Resume shard allocation\n```\nes resume cluster1\n```\n\n## Search documents\n\nSearch the index `myindex` for documents containing `\"Hello world!\"` in the `title` field. Return fields\n`field1` and `field2` of the document with the most recent value of the `updated_at` field:\n\n```\nes search cluster1.mydomain.com:9200 myindex -i field1,field2 -s updated_at:desc -n 1 -q 'title:\"Hello world!\"'\n```\n\nSearch the index `myindex` for documents containing `12345` in the `field1` field. Return 10 documents' sources,\nomitting the `boringfield` field.\n\n```\nes search cluster1.mydomain.com:9200 myindex -e boringfield -n 10 -f source '{\"query\":{\"term\":{\"field1\":12345}}}'\n```\n\nShow the number of documents in the index `myindex` with field `field1` value greater or equal to 10:\n\n```\nes search cluster1.mydomain.com:9200 myindex -n 0 -c -q 'field1:\u003e=10'\n```\n\nNOTE: ES 7.x and above will not return exact document count by default. Use `-c -C true` to print the exact value.\n\n## Count documents\n\nCount documents containing `\"Hello world!\"` in the `title` field in the index `myindex`.\n\n```\nes count cluster1.mydomain.com:9200 myindex -q 'title:\"Hello world!\"'\n```\n\n## Add or remove index alias\n\nAdd alias `alias1` to `myindex1` and alias `alias2` to `myindex2`:\n\n```\nes alias cluster1.mydomain.com:9200 -a alias1=myindex1 -a alias2=myindex2\n```\n\nRemove alias `alias1` from `myindex1` and alias `alias2` from `myindex2`:\n\n```\nes alias cluster1.mydomain.com:9200 -r alias1=myindex1 -r alias2=myindex2\n```\n\nMove index alias `current` from `index-3` to `index-4`\n```\nes alias cluster1.mydomain.com:9200 -r current=index-3 -a current=index-4\n```\n\nRemove alias `alias1` and add alias `alias2` to `index`.\n```\nes alias cluster1.mydomain.com:9200 index -r alias1 -a alias2\n```\n\n## Get document(s) by id\n\n```\nes get cluster1.mydomain.com:9200 myindex docid\n```\n\nMultiget:\n```\nes get cluster1.mydomain.com:9200 myindex docid1 docid2 docid3\n```\n\n## Put document with or without id\n\n```\nes put cluster1.mydomain.com:9200 myindex docid '{ \"first_name\": \"John\", \"last_name\": \"Doe\" }'\n```\n\n```\nes put cluster1.mydomain.com:9200 myindex '{ \"first_name\": \"Jane\", \"last_name\": \"Doe\" }'\n```\n\n```\necho '{ \"first_name\": \"Johnny\", \"last_name\": \"Doe\" }' | es put cluster1.mydomain.com:9200 myindex docid2\n```\n\n## Delete documents by id\n\n```\nes delete cluster1.mydomain.com:9200 myindex docid1 docid2\n```\n\n## Refresh\n\n```\nes refresh cluster1.mydomain.com:9200 myindex1 myindex2\n```\n\n## Flush\n\n```\nes flush cluster1.mydomain.com:9200 myindex1 myindex2\n```\n\nUse `-f` to force flush, `-s` to issue a synced flush, and `-w` to wait for an already ongoing flush.\n\n## Check health of multiple clusters\n\n```\nes health cluster1.mydomain.com:9200 cluster2.mydomain.com:9200\n```\n\n## Check nodes of a cluster\n\nExpect data0...data9, client0...client4 and master nodes to be present):\n\n```\nes nodes cluster1.mydomain.com:9200 -h data{0..9} master client{0..4}\n```\n\nExpect all nodes listed for cluster `mycluster` in the configuration file to be present:\n\n```\nes nodes mycluster\n```\n\n## Check shard recovery status\n\nDisplay shards which are not in `DONE` stage:\n\n```\nes recovery cluster1.mydomain.com:9200 -e stage done\n```\n\n## Get or set cluster setttings\n\nList all persistent and transient settings:\n```\nes settings cluster1.mydomain.com:9200\n```\n\nList all settings, including default ones:\n```\nes settings cluster1.mydomain.com:9200 -D\n```\n\nUse `-p`, `-t` or `-d` to operate only on persistent, transient or default settings, respectively.\n\nUpdate a persistent cluster setting:\n```\nes settings cluster1.mydomain.com:9200 -p cluster.routing.allocation.enable=none\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyborgize%2Fes-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcyborgize%2Fes-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyborgize%2Fes-cli/lists"}