How to use Analyze index disk usage API?

Hi,

  • We'd like to know how to use _disk_usage api.

  • We are trying to figure out how much disk is used by individual fields in an index.

  • The example mentioned in the doc is a POST request but it has no example data parameters and doesn't say what kinda data need to be sent in the POST request.

We tried to pass some dummy data and got the following error:

curl -H 'Content-Type: application/json' -XPOST  'https://COMPANY_URL/jenkins-logs-2021/_disk_usage' -d '{
    "test" : {
        "test" : "all"
    }
}'

{"error":{"root_cause":[{"type":"invalid_type_name_exception","reason":"mapping type name [_disk_usage] can't start with '_' unless it is called [_doc]"}],"type":"invalid_type_name_exception","reason":"mapping type name [_disk_usage] can't start with '_' unless it is called [_doc]"},"status":400}

We tried adding ?run_expensive_tasks=true&pretty and still no luck:

curl -H 'Content-Type: application/json' -XPOST  'https://COMPANY_URL/jenkins-logs-2021/_disk_usage?run_expensive_tasks=true&pretty' -d '{
    "test" : {
        "test" : "all"
    }
}'

{
  "error" : {
    "root_cause" : [
      {
        "type" : "illegal_argument_exception",
        "reason" : "request [/jenkins-logs-2021/_disk_usage] contains unrecognized parameter: [run_expensive_tasks]"
      }
    ],
    "type" : "illegal_argument_exception",
    "reason" : "request [/jenkins-logs-2021/_disk_usage] contains unrecognized parameter: [run_expensive_tasks]"
  },
  "status" : 400
}

If that is the wrong API OR it doesn't work, please tell us how to calculate disk usage by individual fields in an index.

  • Thank you

What is your Elasticsearch version? If not 7.15, upgrade as this API only exists from 7.15.

oh, ok....we are on 7.14.2 ..thank you...that link is for 7.x so I assumed it would work in 7.14.2

No. Look at the header of the 7.x page.

1 Like

Hi,

We upgraded the cluster to 7.15.0 and we want to update the timeout parameter to more than the default value 30s.
We are now seeing a different error like this:

    "type" : "illegal_argument_exception",
    "reason" : "request [/k8s-2021.09.27/_disk_usage] contains unrecognized parameter: [timeout]"

any idea?

  • Thank you

It looks like a bug. Could you open an issue in GitHub please?

opened an issue here

1 Like

we got a reply here