# Kibana Alert Action Message with Range Vaues

**URL:** https://discuss.elastic.co/t/kibana-alert-action-message-with-range-vaues/205297
**Category:** Kibana
**Created:** [October 25, 2019, 3:42pm UTC](https://discuss.elastic.co/t/kibana-alert-action-message-with-range-vaues/205297 "2019-10-25T15:42:18Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Michael\_Schellhouse](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michael_schellhouse/32/56631_2.png) [@Michael\_Schellhouse](https://discuss.elastic.co/u/Michael_Schellhouse)
#### Post date: [October 25, 2019, 3:42pm UTC](https://discuss.elastic.co/t/kibana-alert-action-message-with-range-vaues/205297/1 "2019-10-25T15:42:18Z")

</div>

I am trying to output search timestamp range in alert notification message rather than the monitor start/end time. Using a 5 minute offset in search.

```
                  "range": {
                        "@timestamp": {
                            "from": "{{period_end}}||-6m",
                            "to": "{{period_end}}||-5m",
                            "include_lower": true,
                            "include_upper": true,
                            "format": "epoch_millis",
                            "boost": 1
                        }

```

UI indicates that only ctx variables are available for painless scripting. {{ctx.periodStart}} and {{ctx.periodEnd}} represent the monitor interval time. Any ideas on how to solve this?

```
Working extraction query code:
    {
        "size": 0,
        "query": {
            "bool": {
                "must": [
                    {
                        "query_string": {
                            "query": "\"Cause = 504 Gateway Time-out\"",
                            "fields": [],
                            "type": "best_fields",
                            "default_operator": "or",
                            "max_determinized_states": 10000,
                            "enable_position_increments": true,
                            "fuzziness": "AUTO",
                            "fuzzy_prefix_length": 0,
                            "fuzzy_max_expansions": 50,
                            "phrase_slop": 0,
                            "analyze_wildcard": true,
                            "escape": false,
                            "auto_generate_synonyms_phrase_query": true,
                            "fuzzy_transpositions": true,
                            "boost": 1
                        }
                    },
                    {
                        "match_phrase": {
                            "@owner": {
                                "query": "Production",
                                "slop": 0,
                                "zero_terms_query": "NONE",
                                "boost": 1
                            }
                        }
                    },
                    {
                        "range": {
                            "@timestamp": {
                                "from": "{{period_end}}||-6m",
                                "to": "{{period_end}}||-5m",
                                "include_lower": true,
                                "include_upper": true,
                                "format": "epoch_millis",
                                "boost": 1
                            }
                        }
                    }
                ],
                "adjust_pure_negative": true,
                "boost": 1
            }
        },
        "version": true
    }
```

---

<div class="post-metadata">

### Author: ![Marius\_Dragomir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_dragomir/32/42087_2.png) [@Marius\_Dragomir](https://discuss.elastic.co/u/Marius_Dragomir)
#### Post date: [November 18, 2019, 2:24pm UTC](https://discuss.elastic.co/t/kibana-alert-action-message-with-range-vaues/205297/2 "2019-11-18T14:24:32Z")

</div>

I don't think this is possible for now. The fields accessible are pretty limited.

---

<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: [December 16, 2019, 2:24pm UTC](https://discuss.elastic.co/t/kibana-alert-action-message-with-range-vaues/205297/3 "2019-12-16T14:24:34Z")

</div>

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