Got it working as a switch! Here's the full query rendering to a markdown element:
filters
| essql
query="SELECT \"@timestamp\", \"monitor.status\" as status FROM \"heartbeat*\" WHERE QUERY('my_service') LIMIT 1"
| mapColumn value
fn=${getCell status | switch
{case if={compare eq to="up"} then=Healthy}
{case if={compare eq to="down"} then=Unhealthy}
default="Unknown"
}
| markdown "{{#each rows}}
# {{value}}
{{/each}}"
font={font family="'Open Sans', Helvetica, Arial, sans-serif" size=18 align="left" color="#000000" weight="bold" underline=false italic=false}
| render containerStyle={containerStyle}
(not sure the {{#each rows}}
etc is necessary, happy to take advice on that.
Also FYI I got the answer from this blog post: Canvas Blog Stream
And found examples here: https://github.com/alexfrancoeur/kibana_canvas_examples