Calculate metric to raise alert in kibana

i want to fire an alert with a query condition
if min value = max value and current value > 40 then fire alert
the purpose is to fire the alert if the queue size doesn't decrease over a time interval of 5 minutes
here my query

"script": {
"script": {
"inline": " if (doc['activemq.queue.size'].value.min() = doc['activemq.queue.size'].value.max())
{ if (doc['activemq.queue.size'].value > 40)
{
return doc['activemq.queue.size'].value
}
}",
"lang": "painless"
}
}

but it doesn't work, can you please help with this query

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.