# Why elasticsearch does not come with a CLI?

**URL:** <https://discuss.elastic.co/t/why-elasticsearch-does-not-come-with-a-cli/99485>\
**Category:** Elasticsearch\
**Created:** [September 5, 2017, 8:34pm UTC](https://discuss.elastic.co/t/why-elasticsearch-does-not-come-with-a-cli/99485 "2017-09-05T20:34:42Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![sLuvpreet33](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sluvpreet33/32/50626_2.png) [@sLuvpreet33](https://discuss.elastic.co/u/sLuvpreet33)\
**Post date:** [September 5, 2017, 8:34pm UTC](https://discuss.elastic.co/t/why-elasticsearch-does-not-come-with-a-cli/99485/1 "2017-09-05T20:34:42Z")

</div>

It has been 2-3 months I have been using elasticsearch. I often wonder why we elasticsearch has its own CLI ?

Almost all other databases have a shell.

I am not looking for a CLI. I just want to know why ? Is it not possible ? If not possible, then why ?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [September 5, 2017, 10:56pm UTC](https://discuss.elastic.co/t/why-elasticsearch-does-not-come-with-a-cli/99485/2 "2017-09-05T22:56:36Z")

</div>

Because tools like curl exist on the (linux) shell.  
If you want more, then look at Console (which is part of Kibana), or Postman or similar.

---

<div class="post-metadata">

**Author:** ![mujtabahussain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mujtabahussain/32/17514_2.png) [@mujtabahussain](https://discuss.elastic.co/u/mujtabahussain)\
**Post date:** [September 5, 2017, 11:55pm UTC](https://discuss.elastic.co/t/why-elasticsearch-does-not-come-with-a-cli/99485/3 "2017-09-05T23:55:17Z")

</div>

One of the aspects that I really like about ES is its REST interface. And since using REST via cURL or HTTPie is so simple, that if you were to wrap it around with a CLI, in my very humble opinion, you would not gain much.

If you haven't already, give cURL or HTTPie a go. 🙂

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [September 6, 2017, 12:22am UTC](https://discuss.elastic.co/t/why-elasticsearch-does-not-come-with-a-cli/99485/4 "2017-09-06T00:22:33Z")

</div>

I think there is quite a lot to be gained. MongoDB has a hybrid CLI w/ JSON  
interface. Having a result set as a cursor to iterate through facilitates  
development. Having host/index/type defined as a local variable cuts down  
on the complexity of using curl.

But is a CLI worthwhile? Debatable. Although I would like to use one, I  
would not have it as a priority.

---

<div class="post-metadata">

**Author:** ![sLuvpreet33](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sluvpreet33/32/50626_2.png) [@sLuvpreet33](https://discuss.elastic.co/u/sLuvpreet33)\
**Post date:** [September 6, 2017, 6:48am UTC](https://discuss.elastic.co/t/why-elasticsearch-does-not-come-with-a-cli/99485/5 "2017-09-06T06:48:20Z")

</div>

@Ivan @warkolm @mujtabahussain

Thank you for the answer.

Actually I was doing some sort of research on elastic and influxdb. And there I thought why elastic does not provide a CLI but influx does.

Whenever you find time to explain, Can you give me some or any of those debatable points which were considered while not providing a CLI ? That would be really helpful.

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [September 6, 2017, 11:02am UTC](https://discuss.elastic.co/t/why-elasticsearch-does-not-come-with-a-cli/99485/6 "2017-09-06T11:02:42Z")

</div>

I do not think that a CLI was not created because there was a decision not  
to create one. There is no CLI because there never was one built. How would  
an answer change your usage of a product?

---

<div class="post-metadata">

**Author:** ![thiago](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thiago/32/32096_2.png) [@thiago](https://discuss.elastic.co/u/thiago)\
**Post date:** [September 7, 2017, 5:44am UTC](https://discuss.elastic.co/t/why-elasticsearch-does-not-come-with-a-cli/99485/7 "2017-09-07T05:44:58Z")

</div>

Here is a nice CLI that you can build yourself. It is just one line:

```bash
alias escli='f(){ curl -X$1 "localhost:9200$2" -d "${@:3}" -H "Content-Type: application/json" -s -w "\n"; unset -f f; }; f'

```

Replace `localhost:9200` with your elasticsearch address.

If you have JQ installed you can also pipe the output to it and get a nice colorized output.

```bash
alias escli='f(){ curl -X$1 "localhost:9200$2" -d "${@:3}" -H "Content-Type: application/json" -s | jq .; unset -f f; }; f'

```

Then you can call with:

```bash
$ escli GET /_search '{ "query": { "match_all": {} } }'
{
  "took": 5,
  "timed_out": false,
  "_shards": {
    "total": 0,
    "successful": 0,
    "failed": 0
  },
  "hits": {
    "total": 0,
    "max_score": 0,
    "hits": []
  }
}

```

Works also with cat API (non-jq version):

```bash
$ escli GET /_cat/nodes?v
ip heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name
127.0.0.1 14 42 0 0.00 0.02 0.04 mdi * cLHz5qf

```

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [September 7, 2017, 6:48am UTC](https://discuss.elastic.co/t/why-elasticsearch-does-not-come-with-a-cli/99485/8 "2017-09-07T06:48:05Z")

</div>

That's super cool thing @thiago!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 5, 2017, 6:48am UTC](https://discuss.elastic.co/t/why-elasticsearch-does-not-come-with-a-cli/99485/9 "2017-10-05T06:48:23Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
