# Error creating a watch unexpected token \[START\_OBJECT\]"

**URL:** <https://discuss.elastic.co/t/error-creating-a-watch-unexpected-token-start-object/49977>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [May 13, 2016, 8:57am UTC](https://discuss.elastic.co/t/error-creating-a-watch-unexpected-token-start-object/49977 "2016-05-13T08:57:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Patel\_Viral](https://avatars.discourse-cdn.com/v4/letter/p/a4c791/32.png) [@Patel\_Viral](https://discuss.elastic.co/u/Patel_Viral)\
**Post date:** [May 13, 2016, 8:57am UTC](https://discuss.elastic.co/t/error-creating-a-watch-unexpected-token-start-object/49977/1 "2016-05-13T08:57:34Z")

</div>

Hey, I'm kinda a newbie to Elastic search and I am trying to create watcher but having some issues. Below is the code, it would be great if someone could help me resolving the issue.

{  
"trigger" : {  
"schedule" : {  
"daily" : {  
"at" : {  
"hour" : [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 0, 1],  
"minute" : [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55]  
}  
}  
}  
},  
"input" : {  
"search" : {  
"request" : {  
"indices" : [  
"\<betdata-{now/d}\>",  
"\<betdata-{now/d-1d}\>"  
]  
},  
"body": {  
"query": {  
"filtered": {  
"query": {  
"query\_string": {  
"query": "moduleid:19064 moduleid:19063 moduleid:19075 moduleid:19065 moduleid:19062 moduleid:19061 moduleid:19066",  
"analyze\_wildcard": true,  
"lowercase\_expanded\_terms": false  
}  
},  
"filter": {  
"bool": {  
"must": [  
{  
"range": {  
"@timestamp": {  
"gte": "now-10m"  
}  
}  
}  
]  
}  
}  
}  
}  
}  
}  
},  
"condition" : {  
"compare" : { "ctx.payload.hits.total" : { "lt" : 1 }}  
},  
"transform" : {  
"script" : "return [watchname : ctx.watch\_id, message : "Stopped Receiving Bets On Evolution Platform", "@timestamp" : ctx.execution\_time]"  
},  
"actions" : {  
"email\_alert" : {  
"throttle\_period" : "60m",  
"email": {  
"to":[  
"sdsd@sdsds.com",  
"sdsd@sdsds.com"  
],  
"subject": "[ELASTICSEARCH] {{ctx.watch\_id}}: Stopped Receiving Bets On Evolution Platform",  
"body": "Please check the Evolution Platform, potential issue.",  
"priority": "high"  
}  
},  
"log\_error" : {  
"logging" : {  
"text" : "[WATCHER] {{ctx.payload.message}}",  
"category" : "wintech.NoEvolutionBets",  
"level" : "INFO"  
}  
},  
"index\_payload" : {  
"index" : {  
"index" : "watcher\_alerts",  
"doc\_type" : "alert"  
}  
}  
}  
}

---

<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:** [May 13, 2016, 9:48am UTC](https://discuss.elastic.co/t/error-creating-a-watch-unexpected-token-start-object/49977/2 "2016-05-13T09:48:20Z")

</div>

Hey,

indeed the error message is not good. The problem here is that you are closing the `request` object after the `indices` array, so the query is not part of your request.

Also you could replace the schedule part with

```auto
  "trigger": {
    "schedule": {
      "interval" : "5m"
    }
  }

```

Hope this helps.

--Alex

---

<div class="post-metadata">

**Author:** ![Patel\_Viral](https://avatars.discourse-cdn.com/v4/letter/p/a4c791/32.png) [@Patel\_Viral](https://discuss.elastic.co/u/Patel_Viral)\
**Post date:** [May 13, 2016, 10:32am UTC](https://discuss.elastic.co/t/error-creating-a-watch-unexpected-token-start-object/49977/3 "2016-05-13T10:32:28Z")

</div>

Hey Alex,

Thanks, sorry completely new to this could you point me in the right  
direction in regards to the request object and indices array. Apologies  
really new to this.

Many Thanks,  
Viral

---

<div class="post-metadata">

**Author:** ![Patel\_Viral](https://avatars.discourse-cdn.com/v4/letter/p/a4c791/32.png) [@Patel\_Viral](https://discuss.elastic.co/u/Patel_Viral)\
**Post date:** [May 13, 2016, 11:07am UTC](https://discuss.elastic.co/t/error-creating-a-watch-unexpected-token-start-object/49977/4 "2016-05-13T11:07:34Z")

</div>

Not too worry I found it, again thank you so much. Life saver 🙂

---

<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:** [July 6, 2017, 1:45pm UTC](https://discuss.elastic.co/t/error-creating-a-watch-unexpected-token-start-object/49977/5 "2017-07-06T13:45:35Z")

</div>


