Pretty option for kibana rest api?

I tried running this command:

curl -X GET -u myuser:mypass "https://localhost:5601/api/alerting/rules/_find?pretty=true"

But I get the error

{"statusCode":400,"error":"Bad Request","message":"[request query.pretty]: definition for this key is missing"}

If I remove the ?pretty=true from my request, then everythign works fine. What is the option that I can pass to get pretty formatted json when working with kibana rest api?

Do not looks like there is one ... huh...

I use jq all the time for all sorts of things

Then you just do ..

curl http://localhost:5601/api/index_management/indices | jq
[
  {
    "health": "green",
    "status": "open",
    "name": ".apm-agent-configuration",
    "uuid": "dWjl3Z1hTNqjbD_4RSn7aA",
    "primary": "1",
    "replica": "0",
    "documents": 0,
    "documents_deleted": 0,
    "size": "225b",
    "primary_size": "225b",
    "isFrozen": false,
    "aliases": "none",
    "hidden": true,
    "ilm": {},
    "isRollupIndex": false,
    "isFollowerIndex": false
  },
...

Then you can or fun stuff like .. look into the array and give me all the values with key name

curl http://localhost:5601/api/index_management/indices | jq .[].name
".apm-agent-configuration"
".apm-custom-link"
".ds-.logs-deprecation.elasticsearch-default-2022.10.31-000001"
".ds-ilm-history-5-2022.10.31-000001"
".kibana-event-log-8.4.3-000001"
".kibana_8.4.3_001"
".kibana_task_manager_8.4.3_001"
".tasks"
"testing-7.17.3-cisco.asa-2022.10.31"

This would make a really good feature request if you would be up for opening on on GitHub? :slight_smile:

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