Using curl to cat indices

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"

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"

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

thanks

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

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"

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 '

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.

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