# Using curl to cat indices

**URL:** <https://discuss.elastic.co/t/using-curl-to-cat-indices/302855>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-monitoring\
**Created:** [April 20, 2022, 8:40pm UTC](https://discuss.elastic.co/t/using-curl-to-cat-indices/302855 "2022-04-20T20:40:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![eh2021-elastic](https://avatars.discourse-cdn.com/v4/letter/e/e9bcb4/32.png) [@eh2021-elastic](https://discuss.elastic.co/u/eh2021-elastic)\
**Post date:** [April 20, 2022, 8:40pm UTC](https://discuss.elastic.co/t/using-curl-to-cat-indices/302855/1 "2022-04-20T20:40:59Z")

</div>

I am trying to use curl to pull back a specific set of indexs based on the date. The curl command I try running is below.

> curl -X GET -u user -k "[http://masterIP:9200/\_cat/indices/\*2202-03-30?bytes=mb&v=true&s=index](http://masterIP:9200/_cat/indices/*2202-03-30?bytes=mb&v=true&s=index)"

for some reason the asterisks are removed so it should be asterisk2202-03-30asterisk

when I run this command from a host it returns the column headers with no index information. I can run the same \_cat command in Kibana dev tools and it returns all the index's that have that date. If I run the command to pull a specific index like below it returns the data.

> curl -X GET -u user -k "[http://masterIP:9200/\_cat/indices/index-forward-2202-03-30?bytes=mb&v=true&s=index](http://masterIP:9200/_cat/indices/index-forward-2202-03-30?bytes=mb&v=true&s=index)"

Is this a limitation of using curl and wildcards or do I need to do something different.

thanks

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [April 20, 2022, 8:48pm UTC](https://discuss.elastic.co/t/using-curl-to-cat-indices/302855/2 "2022-04-20T20:48:14Z")

</div>

When I copied your command it had spaces in it

I also notice you have `2202` not `2022`

Also what `user` are you using.. same as you logged in kibana with ... you also need the password

`-u "user:password"`

`curl -X GET -u user -k "http://masterIP:9200/_cat/indices/ *2202-03-30* ?bytes=mb&v=true&s=index"`

I just ran this..

`curl -u "elastic:password" "http://localhost:9200/_cat/indices/*2022*?v"`

Ran fine

```auto
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
green open heartbeat-7.8.0-2022.01.27-000020 Ez7DvtjOQNOkzeCYzNkhkQ 1 1 1814582 0 1.2gb 646mb
green open partial-filebeat-7.15.2-2022.04.07-000129 ZIB2IpdSTBCX1JwFFvMS-w 1 0 10113968 0 0b 0b
green open info-essp-20220201 QppyUzWkTcGgeWLn8KEZsA 1 1 1215 0 267.9kb 133.9kb

```

I also ran with a `-` just to check

`curl -u "elastic:password" "http://localhost:9200/_cat/indices/*2022*-00*?v"`

```auto
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
green open heartbeat-7.8.0-2022.01.27-000020 Ez7DvtjOQNOkzeCYzNkhkQ 1 1 1814582 0 1.2gb 646mb
green open partial-filebeat-7.15.2-2022.04.07-000129 ZIB2IpdSTBCX1JwFFvMS-w 1 0 10113968 0 0b 0b
green open metricbeat-7.10.2-2022.04.15-000349 St5SOvaYR7u5EBNaq8r3xw 1 1 161420 0 136.4mb 68mb
green open metricbeat-7.10.2-2022.04.14-000348 BIb4SeHoRXmr5oFzKcO_xg 1 1 161443 0 137mb 69.1mb
green open metricbeat-7.15.2-2022.04.05-000124 ElSmzYuMTP-eIz1l4-mHcg 1 1 36106568 0 15gb 7.5gb
green open metricbeat-7.15.2-2022.04.06-000125 2QernwT0QGmpg4RVHimFkQ 1 1 36136207 0 15gb 7.5gb

```

You can also try Single Quotes everywhere `'`

---

<div class="post-metadata">

**Author:** ![eh2021-elastic](https://avatars.discourse-cdn.com/v4/letter/e/e9bcb4/32.png) [@eh2021-elastic](https://discuss.elastic.co/u/eh2021-elastic)\
**Post date:** [April 21, 2022, 1:09am UTC](https://discuss.elastic.co/t/using-curl-to-cat-indices/302855/3 "2022-04-21T01:09:38Z")

</div>

Thanks, looks like I had the year wrong as you stated, man looked at that many times and didn't see it. I was not able to pass the password with the username like you showed, it would fail unable to authenticate user but if I just put the username it will prompt and entering the password works.

---

<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:** [May 19, 2022, 1:09am UTC](https://discuss.elastic.co/t/using-curl-to-cat-indices/302855/4 "2022-05-19T01:09:39Z")

</div>

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