# Scripted fields Mb to bytes

**URL:** <https://discuss.elastic.co/t/scripted-fields-mb-to-bytes/109438>\
**Category:** Kibana\
**Created:** [November 28, 2017, 4:35pm UTC](https://discuss.elastic.co/t/scripted-fields-mb-to-bytes/109438 "2017-11-28T16:35:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jose\_Campos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jose_campos/32/11259_2.png) [@Jose\_Campos](https://discuss.elastic.co/u/Jose_Campos)\
**Post date:** [November 28, 2017, 4:35pm UTC](https://discuss.elastic.co/t/scripted-fields-mb-to-bytes/109438/1 "2017-11-28T16:35:29Z")

</div>

Hello

There is some way to convert Mb to bytes. I have a field where Mb and sometimes bytes come, but I want it to always be bytes or that number (1.9 Mb = 1.9e + 6 bytes) multiply it to be bytes.

 ![scrpted](https://us1.discourse-cdn.com/elastic/original/3X/d/7/d702700d952864349c01bcc3b53b4e4b6414b988.PNG)

Thanks for your support

---

<div class="post-metadata">

**Author:** ![Joe\_Fleming](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joe_fleming/32/3561_2.png) [@Joe\_Fleming](https://discuss.elastic.co/u/Joe_Fleming)\
**Post date:** [November 28, 2017, 5:54pm UTC](https://discuss.elastic.co/t/scripted-fields-mb-to-bytes/109438/2 "2017-11-28T17:54:04Z")

</div>

Unfortunately, no. If you were storing the byte value, you could use a field formatter to convert it to megabytes, but there's not a formatter that would allow you to go the other way.

You could enrich the data at index time to store both values (bytes and megabytes), if you need to store, or only have access to, the megabyte value. This can be done as part of your ingest process, via Logstash if you're already using that, using an [ingest node](https://www.elastic.co/guide/en/elasticsearch/reference/master/ingest.html), as some possible solutions.

---

<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:** [December 26, 2017, 5:54pm UTC](https://discuss.elastic.co/t/scripted-fields-mb-to-bytes/109438/3 "2017-12-26T17:54:08Z")

</div>

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