# Similar elasticsearch commands

**URL:** https://community.cratedb.com/t/similar-elasticsearch-commands/1455
**Category:** CrateDB
**Tags:** sql
**Created:** [April 19, 2023, 1:50pm UTC](https://community.cratedb.com/t/similar-elasticsearch-commands/1455 "2023-04-19T13:50:29Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Legatti](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/legatti/32/907_2.png) [@Legatti](https://community.cratedb.com/u/Legatti)
#### Post date: [April 19, 2023, 1:50pm UTC](https://community.cratedb.com/t/similar-elasticsearch-commands/1455/1 "2023-04-19T13:50:29Z")

</div>

Hi,

Is there any similar elasticsearch commands below using curl that I can use on cratedb also using curl command?

curl “$HOSTNAME:9200/\_cluster/settings?pretty=true”  
curl “$HOSTNAME:9200/\_cat/health?v”  
curl “$HOSTNAME:9200/\_cat/allocation?v”  
curl “$HOSTNAME”:9200/\_cat/nodes?v  
curl “$HOSTNAME:9200/\_nodes/stats?pretty”  
curl “$HOSTNAME:9200/\_cat/master?v”

Thanks

---

<div class="post-metadata">

### Author: ![hernanc](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/hernanc/32/676_2.png) [@hernanc](https://community.cratedb.com/u/hernanc)
#### Post date: [April 19, 2023, 1:57pm UTC](https://community.cratedb.com/t/similar-elasticsearch-commands/1455/2 "2023-04-19T13:57:37Z")

</div>

Hi,  
You can use `curl` to get SQL queries executed against CrateDB  
[HTTP endpoint — CrateDB: Reference](https://crate.io/docs/crate/reference/en/5.3/interfaces/http.html)

You can then get this kind of information from `sys.cluster`, `sys.health`, `sys.shards`, and `sys.nodes`.  
Take a look at [System information — CrateDB: Reference](https://crate.io/docs/crate/reference/en/5.3/admin/system-information.html) for an idea of what is available.

I hope this helps, but please let us know if you have difficulties finding any specific information.

Thank you.

---

<div class="post-metadata">

### Author: ![Legatti](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/legatti/32/907_2.png) [@Legatti](https://community.cratedb.com/u/Legatti)
#### Post date: [April 19, 2023, 5:41pm UTC](https://community.cratedb.com/t/similar-elasticsearch-commands/1455/3 "2023-04-19T17:41:55Z")

</div>

Hi,

Okay, I’ll try some commands in my test environment and paste the results here as examples

Thanks.

---

<div class="post-metadata">

### Author: ![Legatti](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/legatti/32/907_2.png) [@Legatti](https://community.cratedb.com/u/Legatti)
#### Post date: [April 20, 2023, 6:11pm UTC](https://community.cratedb.com/t/similar-elasticsearch-commands/1455/4 "2023-04-20T18:11:53Z")

</div>

**Cluster**

`curl -sSXPOST 'user:pass@node01:4200/_sql?pretty' -d '{"stmt":"select name from sys.cluster"}' | jq`

```auto
{
  "cols": [
    "name"
  ],
  "rows": [
    [
      "mycluster"
    ]
  ],
  "rowcount": 1,
  "duration": 0.653828
}

```

**Health**

`curl -sSXPOST 'user:pass@node01:4200/_sql?pretty' -d '{"stmt":"select health,count(*) qty from sys.health group by health"}' | jq`

```auto
{
  "cols": [
    "health",
    "qty"
  ],
  "rows": [
    [
      "GREEN",
      24
    ]
  ],
  "rowcount": 1,
  "duration": 1.107071
}

```

**Nodes**

`curl -sSXPOST 'user:pass@node01:4200/_sql?pretty' -d '{"stmt":"select hostname from sys.nodes order by hostname"}' | jq`

```auto
{
  "cols": [
    "hostname"
  ],
  "rows": [
    [
      "node01"
    ],
    [
      "node02"
    ],
    [
      "node03"
    ]
  ],
  "rowcount": 3,
  "duration": 2.470829
}

```

**Allocation**

`curl -sSXPOST 'user:pass@node01:4200/_sql?pretty' -d '{"stmt":"select decisions[2]['\''node_name'\''] node,count(*) qty from sys.allocations group by decisions[2]['\''node_name'\'']"}' | jq`

```auto
{
  "cols": [
    "node",
    "qty"
  ],
  "rows": [
    [
      "node01",
      48
    ],
    [
      "node02",
      48
    ],
    [
      "node03",
      48
    ]
  ],
  "rowcount": 3,
  "duration": 8.945432
}

```

#
