# Rounding up values in extraction queries

**URL:** <https://discuss.elastic.co/t/rounding-up-values-in-extraction-queries/313981>\
**Category:** Kibana\
**Tags:** elastic-stack-alerting, kql-kibana-query-language, eql-elastic-query-language\
**Created:** [September 8, 2022, 10:23am UTC](https://discuss.elastic.co/t/rounding-up-values-in-extraction-queries/313981 "2022-09-08T10:23:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marius\_Kunauskas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_kunauskas/32/98686_2.png) [@Marius\_Kunauskas](https://discuss.elastic.co/u/Marius_Kunauskas)\
**Post date:** [September 8, 2022, 10:23am UTC](https://discuss.elastic.co/t/rounding-up-values-in-extraction-queries/313981/1 "2022-09-08T10:23:47Z")

</div>

When setting up an alert and defining by using an extraction query, how do I make the response come out as a rounded value? What is the general syntax and where do I specify this? Example:

```auto
{
  "aggs": {
    "2": {
      "avg": {
        "field": "XXX"
      }
    }
  },
  "size": 0,
  "stored_fields": [
    "*"
  ],
  "script_fields": {},
  "docvalue_fields": [
    {
      "field": "@timestamp",
      "format": "date_time"
    },
    {
      "field": "timestamp",
      "format": "date_time"
    }
  ],
  "_source": {
    "excludes": []
  },
  "query": {
    "bool": {
      "must": [],
      "filter": [
        {
          "match_all": {}
        },
        {
          "range": {
            "@timestamp": {
              "gte": "2022-09-08T10:41:02.738Z",
              "lte": "2022-09-08T10:56:02.738Z",
              "format": "strict_date_optional_time"
            }
          }
        }
      ],
      "should": [],
      "must_not": []
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![jsanz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jsanz/32/53734_2.png) [@jsanz](https://discuss.elastic.co/u/jsanz)\
**Post date:** [September 9, 2022, 2:14pm UTC](https://discuss.elastic.co/t/rounding-up-values-in-extraction-queries/313981/2 "2022-09-09T14:14:44Z")

</div>

I don't think you can round values from a pure Elasticsearch query, neither from the templating language ([Handlebars](https://handlebarsjs.com/)) used by Kibana to format text strings in actions like email.

In any case, I also don't think you can use aggregations in the Elasticsearch Query alert, according to this statement from this [other post](https://discuss.elastic.co/t/alerting-on-index-aggregation-with-filter/311763/2) by @Patrick_Mueller

> The elasticsearch query rule is the other "generic" rule type, but does not yet support aggregations, so I don't think you can use that one either.

Check the rest of the comment for some further advice.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 7, 2022, 2:14pm UTC](https://discuss.elastic.co/t/rounding-up-values-in-extraction-queries/313981/3 "2022-10-07T14:14:59Z")

</div>

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