Shape issue in Canvas

the below is giving me the following error ([if] > [gte] > Can not cast 'shape' to any of 'number, string'), I have tried the switch case but also didn't work, can anyone help me please

filters
| essql 
  query="SELECT COUNT(*) as count FROM \"event*\" WHERE message.statusName='Confirmed' AND message.affiliateName='xyz'AND environment.keyword='Production' AND \"@timestamp\" > NOW() - INTERVAL 1 HOUR"
| math "count"
| if condition={lte 2} then={shape shape="square" fill="Red" border="rgba(255,255,255,0)" borderWidth=3 maintainAspect=true}
| if condition={gte 2} && {lte 4} then={shape shape="square" fill="Yellow" border="rgba(255,255,255,0)" borderWidth=3 maintainAspect=true}
| if condition={gte 5} then={shape shape="square" fill="Green" border="rgba(255,255,255,0)" borderWidth=3 maintainAspect=true}
| render

With multiple conditions a switch statement is required. This expression worked for me to play with a value and shape colors

kibana 
| selectFilter 
| essql query="select 5 as count"
| math expression="count"
| switch 
    {case if={lte 0} then={shape shape="square" fill="Red"}}
    {case if={all {gt 0} {lte 1}} then={shape shape="square" fill="Blue"}}
    default={shape shape="square" fill="Green"}
| render 

Change that static value in the ESSQL expression to see how colors go from red, to blue, to green.

Hope it helps.