# Mapping for Bytes/percentage format

**URL:** <https://discuss.elastic.co/t/mapping-for-bytes-percentage-format/97430>\
**Category:** Elasticsearch\
**Created:** [August 17, 2017, 1:44pm UTC](https://discuss.elastic.co/t/mapping-for-bytes-percentage-format/97430 "2017-08-17T13:44:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![randude](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/randude/32/34911_2.png) [@randude](https://discuss.elastic.co/u/randude)\
**Post date:** [August 17, 2017, 1:44pm UTC](https://discuss.elastic.co/t/mapping-for-bytes-percentage-format/97430/1 "2017-08-17T13:44:01Z")

</div>

Hi,  
Is there a way to define automatically the format for some fields via a custom mapping?  
I'm talking about the BYTES or Percentage format.

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [August 18, 2017, 7:39am UTC](https://discuss.elastic.co/t/mapping-for-bytes-percentage-format/97430/2 "2017-08-18T07:39:32Z")

</div>

Hey,

this conversion either needs to be done at index time (i.e. via script processor that calculates this and puts it into a non-indexed field) or on the client side.

--Alex

---

<div class="post-metadata">

**Author:** ![randude](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/randude/32/34911_2.png) [@randude](https://discuss.elastic.co/u/randude)\
**Post date:** [August 18, 2017, 8:06am UTC](https://discuss.elastic.co/t/mapping-for-bytes-percentage-format/97430/3 "2017-08-18T08:06:40Z")

</div>

Hey,  
I think you didn't fully understand what I meant.  
In kibana, you can edit the format of a number and set the special format into Bytes.  
I'd like to be able to set this automatically whenever a new index is created each day instead of having to manually edit the specific field in Kibana.  
Perhaps I should post this in the kibana board?

---

<div class="post-metadata">

**Author:** ![Nikhil\_Utane](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nikhil_utane/32/27547_2.png) [@Nikhil\_Utane](https://discuss.elastic.co/u/Nikhil_Utane)\
**Post date:** [August 22, 2017, 7:09am UTC](https://discuss.elastic.co/t/mapping-for-bytes-percentage-format/97430/4 "2017-08-22T07:09:10Z")

</div>

I have the same question. Just as we can update the format from Kibana. How to specify the same through PUT mapping API?  
Every property has format field, I tried specifying 'bytes' but it throws an exception. Thanks.

---

<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:** [September 19, 2017, 7:09am UTC](https://discuss.elastic.co/t/mapping-for-bytes-percentage-format/97430/5 "2017-09-19T07:09:12Z")

</div>

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