How to get a scripted field value as metric in heatmap

My scenario - 

On heatmap, I want y axis to be defined in three rows, one for each environment(dev,test,val) and x axis should correspond to latest 10 builds for each environment.
Each cell in a heatmap represents a unique build.

Based on the success/failure status of a build for a particular environment, corresponding cell color to be changed to green if succeeded and red if failed.

For that, I have created one scripted field which converts result into an integer value - 1 if succeeded and 0 if failed.
<
if (!doc['result.keyword'].empty) { 
    return doc['result.keyword'].value == "succeeded" ? 1 : 0;    
}   
return null; 
>

But I am not able to figure out how to show colored status of last build for each environment in a heatmap.
Hereby attaching a mock heatmap for your reference.

![heatmap|624x175](upload://nAcCM3jOyKYNFJwMOtAStVNa3Po.jpeg) 

Thanks

Metrics
min/max of your field value
Buckets
x-axis - timestamp per minute/hour/whatever
y-axis - environment.keyword

This will show the different max/min values of your field, according to the last time span.

Hi AClerk,

The solution provided by you does not match our requirement.
Let me summarize the usecase in a more precise way.

We want a visualization which should depict the last 10 days build status for each environment(Dev,Test,Val,Prod) where cell color will show status/result of build - succeeded(green) and failed(Red).

Please suggest which visualization should be used for this use case and how can we achieve it.

We have tried using heatmap but it didnot help.

Thanks

Why it does not match the requirments? What are they?
Can you provide sample data?

Hi,

Now we have changed our approach. we are preparing three different heatmaps for each environment, which resolved our problem

Thanks