# How to set Time range in Watcher

**URL:** <https://discuss.elastic.co/t/how-to-set-time-range-in-watcher/239617>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [July 2, 2020, 11:04am UTC](https://discuss.elastic.co/t/how-to-set-time-range-in-watcher/239617 "2020-07-02T11:04:18Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![skdas](https://avatars.discourse-cdn.com/v4/letter/s/53a042/32.png) [@skdas](https://discuss.elastic.co/u/skdas)\
**Post date:** [July 2, 2020, 11:04am UTC](https://discuss.elastic.co/t/how-to-set-time-range-in-watcher/239617/1 "2020-07-02T11:04:18Z")

</div>

Hello Elastic Team,

I am trying to set time range in my below watcher configuration but i am getting an error while configuring the Watcher could you please assist.

# Watcher Configuration

```auto
{
  "trigger": {
    "schedule": {
      "interval": "1d"
    }
  },
  "input": {
    "none": {}
  },
  
  "range": {
    "@timestamp": {
       "gte": "now-3m"
      }
     }
   },
  "condition": {
    "always": {}
  },
  "actions": {
    "email_admin": {
      "email": {
        "account": "exchange_account",
        "profile": "outlook",
        "attachments": {
          "payments_dashboard.pdf": {
            "reporting": {
              "url": "https://113aff96d90e42f59d2d1c8963267d8e.elk-dev.lowes.com:9243/api/reporting/generate/printablePdf?jobParams=(browserTimezone:UTC,layout:(dimensions:(height:1100,width:1632),id:preserve_layout),objectType:dashboard,relativeUrls:!(%27%2Fapp%2Fkibana%23%2Fdashboard%2F23fdf660-3bbf-11ea-9a4f-dfd98f1e40a2%3F_g%3D(refreshInterval:(pause:!!f,value:10000),time:(from:now-1h,to:now))%26_a%3D(description:!%27!%27,filters:!!(),fullScreenMode:!!f,options:(hidePanelTitles:!!f,useMargins:!!t),panels:!!((embeddableConfig:(),gridData:(h:9,i:!%2769f93113-56ce-4d99-9b8d-b2f67641d299!%27,w:17,x:0,y:0),id:!%276265b9b0-3967-11ea-9a4f-dfd98f1e40a2!%27,panelIndex:!%2769f93113-56ce-4d99-9b8d-b2f67641d299!%27,type:visualization,version:!%277.5.0!%27),(embeddableConfig:(),gridData:(h:9,i:!%278a5ad32a-c8d1-4686-a41d-08e6be90ec75!%27,w:15,x:17,y:0),id:!%274d43b160-396a-11ea-9a4f-dfd98f1e40a2!%27,panelIndex:!%278a5ad32a-c8d1-4686-a41d-08e6be90ec75!%27,type:visualization,version:!%277.5.0!%27),(embeddableConfig:(),gridData:(h:9,i:!%2726b99694-ffaa-408a-b93a-4c9ee57bbc5e!%27,w:16,x:32,y:0),id:faa15d90-3969-11ea-9a4f-dfd98f1e40a2,panelIndex:!%2726b99694-ffaa-408a-b93a-4c9ee57bbc5e!%27,type:visualization,version:!%277.5.0!%27),(embeddableConfig:(),gridData:(h:15,i:!%27282239bd-221e-4a49-9885-0f5de2180063!%27,w:24,x:0,y:9),id:daf5f320-3bc1-11ea-9a4f-dfd98f1e40a2,panelIndex:!%27282239bd-221e-4a49-9885-0f5de2180063!%27,type:visualization,version:!%277.5.0!%27),(embeddableConfig:(),gridData:(h:15,i:!%271c6d75e9-2198-4f0e-9c4e-7ccf360f2586!%27,w:24,x:24,y:9),id:!%276565d820-3bc9-11ea-9a4f-dfd98f1e40a2!%27,panelIndex:!%271c6d75e9-2198-4f0e-9c4e-7ccf360f2586!%27,type:visualization,version:!%277.5.0!%27),(embeddableConfig:(timeRange:(from:now-2d,to:now),title:!%27Approval%2BCount%2BBy%2BHour%2BOver%2BTime!%27),gridData:(h:15,i:!%27226c612d-754e-423e-871d-ccd32f400ed6!%27,w:24,x:0,y:24),id:ae5765d0-3bc9-11ea-9a4f-dfd98f1e40a2,panelIndex:!%27226c612d-754e-423e-871d-ccd32f400ed6!%27,title:!%27Approval%2BCount%2BBy%2BHour%2BOver%2BTime!%27,type:visualization,version:!%277.5.0!%27),(embeddableConfig:(),gridData:(h:15,i:b86f8365-714f-4064-bfe2-f0926246a59f,w:24,x:24,y:24),id:cdaeb340-3bd6-11ea-9a4f-dfd98f1e40a2,panelIndex:b86f8365-714f-4064-bfe2-f0926246a59f,type:visualization,version:!%277.5.0!%27)),query:(language:kuery,query:!%27!%27),timeRestore:!!t,title:!%27Payments%2BSwitch%2B-%2BAuthorization%2BOverview!%27,viewMode:view)%27),title:%27Payments%20Switch%20-%20Authorization%20Overview%27)",
              "retries": 7,
              "interval": "10s",
              "auth": {
                "basic": {
                  "username": "xxxx",
                  "password": "xxxx"
                }
              }
            }
          }
        },
        "from": "xxxxxxxxxxxxxx",
        "to": [
          "xxxxxxxxxxxx"
        ],
        "subject": "Payments Dashboard - Authorization Overview",
        "body": {
          "text": "Sample PDF Dashboard Sent Via Watcher to Email"
        }
      }
    }
  }
} 

```

# Error

Error[parse\_exception] could not parse watch [1994659d-c7d9-468d-be1c-76ba75852da7]. unexpected field [range]

Regards,  
Santosh Kumar Das

---

<div class="post-metadata">

**Author:** ![skdas](https://avatars.discourse-cdn.com/v4/letter/s/53a042/32.png) [@skdas](https://discuss.elastic.co/u/skdas)\
**Post date:** [July 6, 2020, 7:11am UTC](https://discuss.elastic.co/t/how-to-set-time-range-in-watcher/239617/2 "2020-07-06T07:11:51Z")

</div>

Hello Team,

Can somebody please help for my issue.

Regards,  
Santosh Das

---

<div class="post-metadata">

**Author:** ![TimV](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timv/32/13162_2.png) [@TimV](https://discuss.elastic.co/u/TimV)\
**Post date:** [July 6, 2020, 11:50am UTC](https://discuss.elastic.co/t/how-to-set-time-range-in-watcher/239617/3 "2020-07-06T11:50:20Z")

</div>

The watcher content you have posted is not valid JSON. Are you sure that is a verbatim copy of what you are trying to send?

Something strange is going on around the `range` field. Watcher doesn't accept a `range` field in the body like that, and you've got an extra closing bracket (`}`) there as well.

---

<div class="post-metadata">

**Author:** ![skdas](https://avatars.discourse-cdn.com/v4/letter/s/53a042/32.png) [@skdas](https://discuss.elastic.co/u/skdas)\
**Post date:** [July 6, 2020, 1:21pm UTC](https://discuss.elastic.co/t/how-to-set-time-range-in-watcher/239617/4 "2020-07-06T13:21:17Z")

</div>

Yes , could you please help me with right configuration.

if possible please modify my above configuration i want to set my time range in watcher.

//BR

Santosh

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [July 23, 2020, 9:30am UTC](https://discuss.elastic.co/t/how-to-set-time-range-in-watcher/239617/5 "2020-07-23T09:30:55Z")

</div>

The `body` field of the [search input](https://www.elastic.co/guide/en/elasticsearch/reference/7.8/input-search.html) needs to contain the query you want to sent.

---

<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:** [August 20, 2020, 9:30am UTC](https://discuss.elastic.co/t/how-to-set-time-range-in-watcher/239617/6 "2020-08-20T09:30:55Z")

</div>

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