﻿---
title: ES|QL IRATE function
description: 
url: https://www.elastic.co/elastic/docs-builder/docs/2808/reference/query-languages/esql/functions-operators/time-series-aggregation-functions/irate
products:
  - Elasticsearch
---

# ES|QL IRATE function
<applies-to>
  - Elastic Cloud Serverless: Preview
  - Elastic Stack: Preview since 9.2
</applies-to>


## Syntax

![Embedded](https://www.elastic.co/elastic/docs-builder/docs/2808/reference/query-languages/esql/images/functions/irate.svg)


## Parameters

<definitions>
  <definition term="field">
    the metric field to calculate the value for
  </definition>
  <definition term="window">
    the time window over which to compute the irate
  </definition>
</definitions>


## Description

Calculates the irate of a counter field. irate is the per-second rate of increase between the last two data points (it ignores all but the last two data points in each time period). This function is very similar to rate, but is more responsive to recent changes in the rate of increase.

## Supported types


| field           | window                                                                  | result |
|-----------------|-------------------------------------------------------------------------|--------|
| counter_double  | time_duration <applies-to>Elastic Stack: Preview since 9.3</applies-to> | double |
| counter_integer | time_duration <applies-to>Elastic Stack: Preview since 9.3</applies-to> | double |
| counter_long    | time_duration <applies-to>Elastic Stack: Preview since 9.3</applies-to> | double |


## Example

```esql
TS k8s | WHERE pod == "one"
| STATS irate_bytes_in = SUM(IRATE(network.total_bytes_in)) BY cluster, time_bucket = TBUCKET(10minute)
```


| irate_bytes_in:double | cluster:keyword | time_bucket:datetime     |
|-----------------------|-----------------|--------------------------|
| 0.07692307692307693   | prod            | 2024-05-10T00:00:00.000Z |
| 830.0                 | qa              | 2024-05-10T00:00:00.000Z |
| 31.375                | staging         | 2024-05-10T00:00:00.000Z |
| 9.854545454545454     | prod            | 2024-05-10T00:10:00.000Z |
| 18.700000000000003    | qa              | 2024-05-10T00:10:00.000Z |