The condition argument in the if expression will read from the current context which you've piped in with the previous math "count" line. Also, there is no "rectangle" shape type. You probably want "square". This is the list of available shapes.
I think this expression should work for you.
filters
| essql
query="SELECT COUNT(*) as count FROM \"reservation-event*\" WHERE message.affiliateName='xyz' AND message.statusName='Con' AND environment.keyword='Prod' AND \"@timestamp\" > NOW() - INTERVAL 1 HOUR"
| math "count"
| if condition={ lt 1 }
then={shape shape="square" fill="red" border="rgba(255,255,255,0)" borderWidth=0 maintainAspect=true}
else={shape shape="square" fill="green" border="rgba(255,255,255,0)" borderWidth=0 maintainAspect=true}
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.