# Convert string results into failure rates

**URL:** <https://discuss.elastic.co/t/convert-string-results-into-failure-rates/131227>\
**Category:** Kibana\
**Created:** [May 9, 2018, 8:45pm UTC](https://discuss.elastic.co/t/convert-string-results-into-failure-rates/131227 "2018-05-09T20:45:26Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [May 10, 2018, 5:57pm UTC](https://discuss.elastic.co/t/convert-string-results-into-failure-rates/131227/2 "2018-05-10T17:57:12Z")

</div>

Converting the values from success and failure to 100 and 0 respectively shouldn't be too difficult with a scripted field, and logically what you have in that first example is right. In Kibana, you can add a new scripted field, set its type to number, and set the script to the following:

```auto
doc['data.result'].value == 'SUCCESS' ? 100 : 0

```

This will give you a new field, with whatever name you gave it, that maps that string value to a number. Then you can use the field to get the average value in the heat map.

 ![27](https://us1.discourse-cdn.com/elastic/original/3X/7/b/7be095ccaeac048420920586527e1189856b0787.png)

This isn't your data, but the idea is the same. I called my field `ext_val`, as you can see in the metric config.

---

_[View the full topic](https://discuss.elastic.co/t/convert-string-results-into-failure-rates/131227)._
