# Define a Mapping for Percentage or Bytes (GB,MB) in Kibana

**URL:** <https://discuss.elastic.co/t/define-a-mapping-for-percentage-or-bytes-gb-mb-in-kibana/183869>\
**Category:** Kibana\
**Created:** [June 2, 2019, 7:09pm UTC](https://discuss.elastic.co/t/define-a-mapping-for-percentage-or-bytes-gb-mb-in-kibana/183869 "2019-06-02T19:09:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![shanky1997](https://avatars.discourse-cdn.com/v4/letter/s/bc8723/32.png) [@shanky1997](https://discuss.elastic.co/u/shanky1997)\
**Post date:** [June 2, 2019, 7:09pm UTC](https://discuss.elastic.co/t/define-a-mapping-for-percentage-or-bytes-gb-mb-in-kibana/183869/1 "2019-06-02T19:09:32Z")

</div>

What I want is I have a data of disk usage I want alerting on it the data contain: disk\_used: 10 GB like JSON I want to define a **mapping in Kibana** so that I can have an alerting condition for **disk usage greater than 10 GB** I tried to search the same problem but I did not find any useful solution until now, the same problem is with percentage i.e **disk\_utilization: 15%**.

How to define a **mapping** for it I tried something like this:

```
{
  "index_patterns": "diskusage-*",
  "mappings": {
      "properties": {
        "created_at": {
          "type": "date",
          "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
        },
        "disk_usage":{
          "type":"integer"
        },
        "Flowfile_usedSpace":{
           "type":"integer"
      }
  },
  "settings": {
    "number_of_shards": 2,
    "number_of_replicas": 1
  },
  "aliases": {
    "diskusage": {}
  }
}
}`

```

Help is Appreciated,  
Thanks in Advance:🙃.

---

<div class="post-metadata">

**Author:** ![nickpeihl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nickpeihl/32/112622_2.png) [@nickpeihl](https://discuss.elastic.co/u/nickpeihl)\
**Post date:** [June 3, 2019, 5:22pm UTC](https://discuss.elastic.co/t/define-a-mapping-for-percentage-or-bytes-gb-mb-in-kibana/183869/2 "2019-06-03T17:22:04Z")

</div>

[Metricbeat has examples of field types for file system data such as disk usage.](https://www.elastic.co/guide/en/beats/metricbeat/current/exported-fields-system.html#_filesystem_fields)

In short, I think you want to map these fields as `"type": "float"`. The "Format" for how the field is formatted in Kibana can be changed in the Kibana index-pattern.

 ![Screenshot_2019-06-03%20aerospike%20namespace%20device%20available%20pct%20-%20metricbeat-%20-%20Kibana](https://us1.discourse-cdn.com/elastic/original/3X/6/b/6b212805a50399867b7bdfca3b0eb9648fd59593.png)

---

<div class="post-metadata">

**Author:** ![shanky1997](https://avatars.discourse-cdn.com/v4/letter/s/bc8723/32.png) [@shanky1997](https://discuss.elastic.co/u/shanky1997)\
**Post date:** [June 4, 2019, 5:39am UTC](https://discuss.elastic.co/t/define-a-mapping-for-percentage-or-bytes-gb-mb-in-kibana/183869/3 "2019-06-04T05:39:55Z")

</div>

Thanks for the reply @nickpeihl but I do not find edit option once when an index is created can u be a little bit more specific.

```
{
  "index_patterns": "diskusage-*",
  "mappings": {
      "properties": {
        "created_at": {
          "type": "date",
          "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
        },
        "disk_usage":{
          "type":"float"
        }
  },
  "settings": {
    "number_of_shards": 2,
    "number_of_replicas": 1
  },
  "aliases": {
    "diskusage": {}
  }
}
}

```

Will this work for me! or do I have to provide a format too.

I saw the advance index setting option:

 ![bytes](https://us1.discourse-cdn.com/elastic/original/3X/6/9/69d8d781e8d33dd07fc329d677cd536a11f58fd8.png)

---

<div class="post-metadata">

**Author:** ![nickpeihl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nickpeihl/32/112622_2.png) [@nickpeihl](https://discuss.elastic.co/u/nickpeihl)\
**Post date:** [June 4, 2019, 4:05pm UTC](https://discuss.elastic.co/t/define-a-mapping-for-percentage-or-bytes-gb-mb-in-kibana/183869/4 "2019-06-04T16:05:18Z")

</div>

@shanky1997 You can not change the mappings of an index that is already created. You need to reindex your data into a new index. [Reindex API](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html) is one way of doing it.

The Bytes format setting from your screenshot applies formatting to numerical field in your index patterns that have the "Bytes" format (third column).

 ![Screenshot_2019-06-04%20metricbeat-%20-%20Kibana(1)](https://us1.discourse-cdn.com/elastic/original/3X/c/0/c0562840ecf125fc654fa4721ee1ae391c712cb1.png)

If it's feasible for you, I strongly recommend checking out the features of [Metricbeat](https://www.elastic.co/products/beats/metricbeat) as all of this configuration is built-in.

---

<div class="post-metadata">

**Author:** ![shanky1997](https://avatars.discourse-cdn.com/v4/letter/s/bc8723/32.png) [@shanky1997](https://discuss.elastic.co/u/shanky1997)\
**Post date:** [June 7, 2019, 9:02am UTC](https://discuss.elastic.co/t/define-a-mapping-for-percentage-or-bytes-gb-mb-in-kibana/183869/5 "2019-06-07T09:02:35Z")

</div>

thanks @nickpeihl What if i want to **define a mapping at time of creating index** then what type of format is to be given?

---

<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:** [July 5, 2019, 9:13am UTC](https://discuss.elastic.co/t/define-a-mapping-for-percentage-or-bytes-gb-mb-in-kibana/183869/6 "2019-07-05T09:13:33Z")

</div>

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