Convert string results into failure rates

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:

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.

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.