Alternative lucene query to implement rate() function in elasticsearch

I need to convert my PromQL query from my Grafana dashboard into Elasticsearch supported Lucene's query. Currently, there is no such function that can be used as rate() function. Is there any way to implement rate() functionality of Prometheus DS into Elasticsearch.

PromQL query for reference:

sum (rate (container_cpu_system_seconds_total{namespace=~"$Namespace"}[5m]))

The next minor version of the Elastic Stack will likely have support for a rate aggregation and this github issue https://github.com/elastic/elasticsearch/issues/60674