{"id":15151950,"url":"https://github.com/elastic/es2unix","last_synced_at":"2025-09-29T22:31:18.305Z","repository":{"id":6296671,"uuid":"7531201","full_name":"elastic/es2unix","owner":"elastic","description":"Command-line ES","archived":true,"fork":false,"pushed_at":"2023-06-20T23:12:46.000Z","size":164,"stargazers_count":272,"open_issues_count":9,"forks_count":30,"subscribers_count":369,"default_branch":"master","last_synced_at":"2024-09-22T23:03:44.450Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elastic.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}},"created_at":"2013-01-09T23:42:51.000Z","updated_at":"2024-05-01T22:18:55.000Z","dependencies_parsed_at":"2022-08-29T19:40:20.118Z","dependency_job_id":null,"html_url":"https://github.com/elastic/es2unix","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elastic%2Fes2unix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elastic%2Fes2unix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elastic%2Fes2unix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elastic%2Fes2unix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elastic","download_url":"https://codeload.github.com/elastic/es2unix/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219874707,"owners_count":16554610,"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-09-26T15:40:51.582Z","updated_at":"2025-09-29T22:31:18.022Z","avatar_url":"https://github.com/elastic.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# es2unix\n\n**this Repo is now Read-Only and Deprecated since elasticsearch 1.0.  Use the [cat API instead](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/cat.html).  Also check out https://github.com/drewr/copycat.**\n\nElasticsearch API consumable by the command line.\n\nJSON isn't always the most convenient output, particularly on a\nterminal.  The tabular format has stuck around for good reason.  It's\ncompact.  It's line-oriented.  es2unix strives to keep spaces\nsignificant so all output works with existing *NIX tools.  `grep`,\n`sort`, \u0026 `awk` are first-class citizens here.\n\n\n# Install\n\nes2unix's only dependency is Java (Oracle or OpenJDK).  Version 7\nshould be preferred, but there is no functional difference with 6.\nEarlier versions aren't supported.\n\n        curl -s download.elasticsearch.org/es2unix/es \u003e~/bin/es\n        chmod +x ~/bin/es\n\nYou can also pin to a particular version from your provisioning tools.\n\n        curl -s download.elasticsearch.org/es2unix/es-20130503595fce2 \u003e~/bin/es\n\n# Usage\n\nThe `es` command takes subcommands and a few options.  It assumes it's\ntalking to ES at its default HTTP port using `http://localhost:9200`\nbut accepts `-u` to change that.  It must be a fully qualifed URL with\nscheme, host, \u0026 port.\n\nYou can also supply `-v`, for most commands, to print a column header.\n\n\n## Version\n\n        % es version\n        es            1.0.0\n        elasticsearch 0.21.0.Beta1\n\n\n## Health\n\n        % es health -v\n        cluster status nodes data pri shards relo init unassign\n        kluster green      2    2   3      6    0    0        0\n\n## Count\n\nSometimes you need a quick count to tell whether a cluster has any\ndata and whether it's indexing.  You can also supply a query.\n\n        % es count\n        2,319,799\n        % es count elasticsearch\n        3 \"q=elasticsearch\"\n        % es count \"john deacon\"\n        225,839 \"q=john deacon\"\n        % es count \"\\\"saved by the bell\\\"\"\n        220 \"q=\"saved by the bell\"\"\n\n## Search\n\nNot exhaustive access to the query API by any stretch, but it suffices\nwhen you need to get a glance of the data in your cluster.  Searches\nacross indices with a default query of `*:*`.\n\n        % es search\n        1.0     wiki    page 1228929\n        1.0     wiki    page 1229142\n        1.0     wiki    page 1229146\n        1.0     wiki    page 1229153\n        1.0     wiki    page 1228943\n        1.0     wiki    page 1229155\n        1.0     wiki    page 1228950\n        1.0     wiki    page 1229159\n        1.0     wiki    page 1228956\n        1.0     wiki    page 1229160\n         Total: 2319799\n\nCan also specify a query, like `es search \\\"george costanza\\\"`, and,\npossibly more interestingly, a list of fields to return.\n\n        % es search -v \"george costanza\" title\n        score   index  type id      title\n        5.78647 wiki   page 660183  George Costansa\n        5.78647 wiki   page 273868  George Constanza\n        5.63803 wiki   page 865781  Vandelay Industries\n        4.69835 wiki   page 932333  Art Vandelay\n        4.69835 wiki   page 2147975 Can't Stand Ya\n        4.67351 wiki   page 2486208 Art vandelay\n        4.07630 wiki   page 2147959 Costanza\n        3.23200 wiki   page 2147971 The Costanza family\n        3.21007 wiki   page 2147972 Costanza family\n        2.94863 wiki   page 4946953 Santa costanza\n         Total: 118186\n\n## Master\n\n        % es master\n        J-erllamTOiW5WoGVUd04A 127.0.0.1 Slade, Frederick\n\n\n## Indices\n\n        % es indices -v\n        status name   pri rep    docs        size\n        green  _river   0   1       4        8068\n        green  wiki     1   1 1104894 13805525784\n\nMaybe your cluster is red and you need to know which indices are\naffected:\n\n        % es indices | grep \\^red\n        red    bb           5 0\n        red    test         4 1   218b   218  0\n        red    enron        5 0\n        red    uno          1 0\n\n## Allocation\nDisplays shard allocation counts across nodes\n\n        % es allocation -v\n        count ip           name\n           12 192.168.0.24 Sage\n           30 x.x.x.x      UNASSIGNED\n\n## Nodes\n\nWhat HTTP port is `Cannonball I` listening on?  Who's the master?\nWho's master-eligible?  Who's got `data=true`?\n\n        % es nodes\n        Uv1Iy8FvR0y6_RzPXKBolg 127.0.0.1 9201 127.0.0.1 9300   d Cannonball I\n        J-erllamTOiW5WoGVUd04A 127.0.0.1 9200 127.0.0.1 9301 * d Slade, Frederick\n        j27iagsmQQaeIpl6yU6mCg 127.0.0.1 9203 127.0.0.1 9303 - c Georgianna Castleberry\n        T1aFDU2BSUm748gYxjEN9w 127.0.0.1 9202 127.0.0.1 9302   d Living Tribunal\n\nIf you have access to logs from all the nodes, you can run `lifecycle`\nto get a playback of all the node joinings and leavings with their\ntimestamps ordered sequentially.  This is much faster than combing the\nlogs and piecing together the sequence manually.\n\n        % es lifecycle /tmp/es-*/logs/elasticsearch.log\n        2013-02-08 13:47:15,516 Lurking Unknown INIT   0.21.0.Beta1-SNAPSHOT\n        2013-02-08 13:47:20,413 Lurking Unknown MASTER Lurking Unknown\n        2013-02-08 13:47:20,467 Lurking Unknown START\n        2013-02-08 13:47:36,319 Cameron Hodge   INIT   0.21.0.Beta1-SNAPSHOT\n        2013-02-08 13:47:41,211 Lurking Unknown ADD    Cameron Hodge\n        2013-02-08 13:47:41,223 Cameron Hodge   MASTER Lurking Unknown\n        2013-02-08 13:47:41,278 Cameron Hodge   START\n        2013-02-08 13:47:59,426 Armageddon      INIT   0.21.0.Beta1-SNAPSHOT\n        2013-02-08 13:48:04,279 Lurking Unknown ADD    Armageddon\n        2013-02-08 13:48:04,280 Cameron Hodge   ADD    Armageddon\n        2013-02-08 13:48:04,287 Armageddon      MASTER Lurking Unknown\n        2013-02-08 13:48:04,340 Armageddon      START\n        2013-02-08 13:48:30,333 Lurking Unknown REMOVE Armageddon\n        2013-02-08 13:48:30,339 Cameron Hodge   REMOVE Armageddon\n        2013-02-08 13:48:30,362 Armageddon      STOP\n\n## Heap\n\nHeap across the cluster.\n\n        % es heap | sort -rnk6\n        XO6c2A1D 23.9mb 25138608 123.7mb  129761280 19.4% 127.0.0.1 Junkpile\n        uVP8g9_l 94.6mb 99257976 990.7mb 1038876672  9.6% 127.0.0.1 Hammond, Jim\n        pjbeg_k8 76.9mb 80730208 990.7mb 1038876672  7.8% 127.0.0.1 Scarlet Centurion\n\nFor some quick and dirty monitoring, I like to put this in a loop.\n\n        % while true; do es heap | sort -rnk6 | head -1; sleep 60; done\n        XO6c2A1D 57.3mb 60157200 123.7mb 129761280 46.4% 127.0.0.1 Junkpile\n        XO6c2A1D 54.7mb 57405904 123.7mb 129761280 44.2% 127.0.0.1 Junkpile\n        XO6c2A1D 62.7mb 65834752 123.7mb 129761280 50.7% 127.0.0.1 Junkpile\n        XO6c2A1D 56.9mb 59743504 123.7mb 129761280 46.0% 127.0.0.1 Junkpile\n        XO6c2A1D 52.1mb 54676216 123.7mb 129761280 42.1% 127.0.0.1 Junkpile\n        XO6c2A1D 37.1mb 38971744 123.7mb 129761280 30.0% 127.0.0.1 Junkpile\n        XO6c2A1D   52mb 54528424 123.7mb 129761280 42.0% 127.0.0.1 Junkpile\n        XO6c2A1D 46.5mb 48787064 123.7mb 129761280 37.6% 127.0.0.1 Junkpile\n\nThis can be extremely helpful during indexing, for example.  If you\nsee a single node showing up a lot, you might have hot shard(s) there.\nIf you see all the nodes regularly showing up with varying heap usage\npercentage, it's likely a healthy cluster with good shard\ndistribution.\n\nSearching has slightly different characteristics, but you can make\nsimilarly helpful inferences.\n\n\n## Ids\n\nSometimes it's helpful to retrieve the ids of all documents in an ES\nindex.\n\n        % es ids test -v\n        index type id\n        test doc 1\n        test doc 2\n        test doc 3\n        test doc 4\n\n\n## Shards\n\n### Node startup\n\nWe've started up three nodes where we had two before. ES decided to\nmove one shard to the third node.\n\n        % es shards\n        wiki 0 p STARTED    1160290 7.2gb 7776371641 127.0.0.1 Feline\n        wiki 0 r STARTED    1160290 7.2gb 7776371602 127.0.0.1 Jenkins, Abner\n        wiki 1 p RELOCATING 1159509 7.5gb 8116295811 127.0.0.1 Feline -\u003e 127.0.0.1 Amphibius\n        wiki 1 r STARTED    1159509 7.5gb 8116295811 127.0.0.1 Jenkins, Abner\n\n### After turning on more replicas\n\nWe set `index.number_of_replicas` to `2`, so ES is creating another\ncopy of each primary shard.\n\n        % es shards\n        wiki     0 p STARTED      1160290   7.2gb 7776371641 127.0.0.1 Feline\n        wiki     0 r INITIALIZING       0 100.2mb  105077522 127.0.0.1 Amphibius\n        wiki     0 r STARTED      1160290   7.2gb 7776371602 127.0.0.1 Jenkins, Abner\n        wiki     1 r INITIALIZING       0 120.3mb  126157581 127.0.0.1 Feline\n        wiki     1 p STARTED      1159509   7.5gb 8116295811 127.0.0.1 Amphibius\n        wiki     1 r STARTED      1159509   7.5gb 8116295811 127.0.0.1 Jenkins, Abner\n\n### Single node filter by index, sort reverse by bytes\n\nYou can limit the results to a substring match of an index.  This\nfilters that output's sixth column through a descending sort.\n\n        % es shards wik | sort -rnk6\n        wiki 1 r STARTED 2.7gb 2980767835 276016 127.0.0.1 Namora\n        wiki 0 r STARTED 2.7gb 2953985585 276441 127.0.0.1 Namora\n        wiki 1 p STARTED 2.7gb 2909784771 276016 127.0.0.1 Android Man\n        wiki 0 p STARTED 2.6gb 2846741702 276441 127.0.0.1 Android Man\n\n### Normal three-node cluster operation\n\nAdd column names.\n\n        % es shards -v\n        index shard pri/rep state           docs size       bytes ip        node\n        wiki      0 p       STARTED      1160290 7.2gb 7776371641 127.0.0.1 Feline\n        wiki      0 r       INITIALIZING       0 3.1gb 3384641066 127.0.0.1 Amphibius\n        wiki      0 r       STARTED      1160290 7.2gb 7776371602 127.0.0.1 Jenkins, Abner\n        wiki      1 r       INITIALIZING       0 3.7gb 4029041251 127.0.0.1 Feline\n        wiki      1 p       STARTED      1159509 7.5gb 8116295811 127.0.0.1 Amphibius\n        wiki      1 r       STARTED      1159509 7.5gb 8116295811 127.0.0.1 Jenkins, Abner\n\n# Contributing\n\nes2unix is written in Clojure.  You'll need leiningen 2.0+ to build.\n\n        % make package\n\n# License\n\nThis software is licensed under the Apache 2 license, quoted below.\n\n        Copyright 2012-2013 ElasticSearch \u003chttp://www.elasticsearch.org\u003e\n\n        Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n        use this file except in compliance with the License. You may obtain a copy of\n        the License at\n\n            http://www.apache.org/licenses/LICENSE-2.0\n\n        Unless required by applicable law or agreed to in writing, software\n        distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n        WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n        License for the specific language governing permissions and limitations under\n        the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felastic%2Fes2unix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felastic%2Fes2unix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felastic%2Fes2unix/lists"}