# How to use Analyze index disk usage API?

**URL:** <https://discuss.elastic.co/t/how-to-use-analyze-index-disk-usage-api/285119>\
**Category:** Elasticsearch\
**Created:** [September 25, 2021, 12:17am UTC](https://discuss.elastic.co/t/how-to-use-analyze-index-disk-usage-api/285119 "2021-09-25T00:17:33Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rakesh\_B](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rakesh_b/32/48128_2.png) [@Rakesh\_B](https://discuss.elastic.co/u/Rakesh_B)\
**Post date:** [September 25, 2021, 12:17am UTC](https://discuss.elastic.co/t/how-to-use-analyze-index-disk-usage-api/285119/1 "2021-09-25T00:17:33Z")

</div>

Hi,

- We'd like to know how to use [\_disk\_usage](https://www.elastic.co/guide/en/elasticsearch/reference/7.x/indices-disk-usage.html#indices-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:

```auto
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:

```auto
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

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [September 25, 2021, 1:44am UTC](https://discuss.elastic.co/t/how-to-use-analyze-index-disk-usage-api/285119/2 "2021-09-25T01:44:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Rakesh\_B](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rakesh_b/32/48128_2.png) [@Rakesh\_B](https://discuss.elastic.co/u/Rakesh_B)\
**Post date:** [September 25, 2021, 3:01am UTC](https://discuss.elastic.co/t/how-to-use-analyze-index-disk-usage-api/285119/3 "2021-09-25T03:01:35Z")

</div>

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`

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [September 25, 2021, 4:30am UTC](https://discuss.elastic.co/t/how-to-use-analyze-index-disk-usage-api/285119/4 "2021-09-25T04:30:34Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/7/c/7cc4916f00fce7e613b9b40e5eb2c36efb355289.jpeg)

---

<div class="post-metadata">

**Author:** ![Rakesh\_B](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rakesh_b/32/48128_2.png) [@Rakesh\_B](https://discuss.elastic.co/u/Rakesh_B)\
**Post date:** [September 28, 2021, 1:09am UTC](https://discuss.elastic.co/t/how-to-use-analyze-index-disk-usage-api/285119/5 "2021-09-28T01:09:00Z")

</div>

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:

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

```

 ![Screen Shot 2021-09-27 at 6.06.31 PM](https://us1.discourse-cdn.com/elastic/original/3X/6/a/6a7f26a13091c3ac15848c93bfbc63146b0d17c6.png)

any idea?

- Thank you

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [September 28, 2021, 1:51am UTC](https://discuss.elastic.co/t/how-to-use-analyze-index-disk-usage-api/285119/6 "2021-09-28T01:51:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Rakesh\_B](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rakesh_b/32/48128_2.png) [@Rakesh\_B](https://discuss.elastic.co/u/Rakesh_B)\
**Post date:** [September 28, 2021, 3:13am UTC](https://discuss.elastic.co/t/how-to-use-analyze-index-disk-usage-api/285119/7 "2021-09-28T03:13:19Z")

</div>

opened an issue [here](https://github.com/elastic/elasticsearch/issues/78356)

---

<div class="post-metadata">

**Author:** ![Rakesh\_B](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rakesh_b/32/48128_2.png) [@Rakesh\_B](https://discuss.elastic.co/u/Rakesh_B)\
**Post date:** [September 30, 2021, 5:22pm UTC](https://discuss.elastic.co/t/how-to-use-analyze-index-disk-usage-api/285119/8 "2021-09-30T17:22:32Z")

</div>

we got a reply [here](https://github.com/elastic/elasticsearch/issues/78356#issuecomment-931065848)

---

<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:** [October 28, 2021, 5:22pm UTC](https://discuss.elastic.co/t/how-to-use-analyze-index-disk-usage-api/285119/9 "2021-10-28T17:22:57Z")

</div>

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