# Nested: MustacheException\[3 @\[query-template:5\]\]; nested: IndexOutOfBoundsException\[3\]

**URL:** <https://discuss.elastic.co/t/nested-mustacheexception-3-query-template-5-nested-indexoutofboundsexception-3/165423>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [January 23, 2019, 1:51pm UTC](https://discuss.elastic.co/t/nested-mustacheexception-3-query-template-5-nested-indexoutofboundsexception-3/165423 "2019-01-23T13:51:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![balamelangi](https://avatars.discourse-cdn.com/v4/letter/b/c77e96/32.png) [@balamelangi](https://discuss.elastic.co/u/balamelangi)\
**Post date:** [January 23, 2019, 1:51pm UTC](https://discuss.elastic.co/t/nested-mustacheexception-3-query-template-5-nested-indexoutofboundsexception-3/165423/1 "2019-01-23T13:51:06Z")

</div>

{  
"watch\_id": "[platform.wavespot.net](http://platform.wavespot.net)",  
"state": "execution\_not\_needed",  
"status": {  
"state": {  
"active": true,  
"timestamp": "2019-01-23T13:39:36.359Z"  
},  
"last\_checked": "2019-01-23T13:45:37.506Z",  
"last\_met\_condition": "2019-01-23T13:43:37.470Z",  
"actions": {  
"email\_admin": {  
"ack": {  
"timestamp": "2019-01-23T13:39:36.359Z",  
"state": "awaits\_successful\_execution"  
},  
"last\_execution": {  
"timestamp": "2019-01-23T13:43:37.470Z",  
"successful": false,  
"reason": "GeneralScriptException[Error running inline script [Total {{ctx.payload.hits.total}} errors. Below are the errors from {{ctx.payload.hits.hits.0.\_source.beat.hostname}} \n {{ctx.payload.hits.hits.0.\_source.message}} \n {{ctx.payload.hits.hits.1.\_source.message}} \n {{ctx.payload.hits.hits.2.\_source.message}} \n {{ctx.payload.hits.hits.3.\_source.message}} \n {{ctx.payload.hits.hits.4.\_source.message}} \n {{ctx.payload.hits.hits.5.\_source.message}} \n {{ctx.payload.hits.hits.6.\_source.message}} \n {{ctx.payload.hits.hits.7.\_source.message}} \n {{ctx.payload.hits.hits.8.\_source.message}} \n {{ctx.payload.hits.hits.9.\_source.message}} \n] using lang [mustache]]; nested: MustacheException[Failed to get value for ctx.payload.hits.hits.3.\_source.message @[query-template:5]]; nested: MustacheException[3 @[query-template:5]]; nested: IndexOutOfBoundsException[3]; "  
}  
}  
}  
},  
"trigger\_event": {  
"type": "schedule",  
"triggered\_time": "2019-01-23T13:45:37.506Z",  
"schedule": {  
"scheduled\_time": "2019-01-23T13:45:37.078Z"  
}  
},  
"input": {  
"search": {  
"request": {  
"search\_type": "query\_then\_fetch",  
"indices": [  
"platform.wavespot.net-_"  
],  
"types": [],  
"body": {  
"size": 10,  
"query": {  
"bool": {  
"must": {  
"match": {  
"message": "error"  
}  
},  
"filter": {  
"range": {  
"@timestamp": {  
"from": "now-2m",  
"to": "now"  
}  
}  
}  
}  
}  
}  
}  
}  
},  
"condition": {  
"compare": {  
"ctx.payload.hits.total": {  
"gt": 0  
}  
}  
},  
"result": {  
"execution\_time": "2019-01-23T13:45:37.506Z",  
"execution\_duration": 5,  
"input": {  
"type": "search",  
"status": "success",  
"payload": {  
"\_shards": {  
"total": 80,  
"failed": 0,  
"successful": 80,  
"skipped": 0  
},  
"hits": {  
"hits": [],  
"total": 0,  
"max\_score": null  
},  
"took": 4,  
"timed\_out": false  
},  
"search": {  
"request": {  
"search\_type": "query\_then\_fetch",  
"indices": [  
"platform.wavespot.net-_"  
],  
"types": ,  
"body": {  
"size": 10,  
"query": {  
"bool": {  
"must": {  
"match": {  
"message": "error"  
}  
},  
"filter": {  
"range": {  
"@timestamp": {  
"from": "now-2m",  
"to": "now"  
}  
}  
}  
}  
}  
}  
}  
}  
},  
"condition": {  
"type": "compare",  
"status": "success",  
"met": false,  
"compare": {  
"resolved\_values": {  
"ctx.payload.hits.total": 0  
}  
}  
},  
"actions":   
},  
"messages":   
}

I'm getting above error  
My actual watcher is :  
{  
"trigger": {  
"schedule": {  
"interval": "2m"  
}  
},  
"input": {  
"search": {  
"request": {  
"search\_type": "query\_then\_fetch",  
"indices": [  
"platform.wavespot.net-\*"  
],  
"types": ,  
"body": {  
"size": 10,  
"query": {  
"bool": {  
"must": {  
"match": {  
"message": "error"  
}  
},  
"filter": {  
"range": {  
"@timestamp": {  
"from": "now-2m",  
"to": "now"  
}  
}  
}  
}  
}  
}  
}  
}  
},  
"condition": {  
"compare": {  
"ctx.payload.hits.total": {  
"gt": 0  
}  
}  
},  
"actions": {  
"email\_admin": {  
"email": {  
"profile": "standard",  
"to": [  
"Serverops [serverops@something.com](mailto:serverops@something.com)"  
],  
"subject": "Platform: JBOSS Errors from Watcher",  
"body": {  
"text": " Total {{ctx.payload.hits.total}} errors. Below are the errors from {{ctx.payload.hits.hits.0.\_source.beat.hostname}} \n {{ctx.payload.hits.hits.0.\_source.message}} \n {{ctx.payload.hits.hits.1.\_source.message}} \n {{ctx.payload.hits.hits.2.\_source.message}} \n {{ctx.payload.hits.hits.3.\_source.message}} \n {{ctx.payload.hits.hits.4.\_source.message}} \n {{ctx.payload.hits.hits.5.\_source.message}} \n {{ctx.payload.hits.hits.6.\_source.message}} \n {{ctx.payload.hits.hits.7.\_source.message}} \n {{ctx.payload.hits.hits.8.\_source.message}} \n {{ctx.payload.hits.hits.9.\_source.message}} \n"  
}  
}  
}  
}  
}

---

<div class="post-metadata">

**Author:** ![balamelangi](https://avatars.discourse-cdn.com/v4/letter/b/c77e96/32.png) [@balamelangi](https://discuss.elastic.co/u/balamelangi)\
**Post date:** [January 23, 2019, 1:52pm UTC](https://discuss.elastic.co/t/nested-mustacheexception-3-query-template-5-nested-indexoutofboundsexception-3/165423/2 "2019-01-23T13:52:59Z")

</div>

@here someone please help me .

Thanks.

---

<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:** [February 20, 2019, 1:53pm UTC](https://discuss.elastic.co/t/nested-mustacheexception-3-query-template-5-nested-indexoutofboundsexception-3/165423/3 "2019-02-20T13:53:02Z")

</div>

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