# Watcher multiple query with \< and \> in match

**URL:** <https://discuss.elastic.co/t/watcher-multiple-query-with-and-in-match/248691>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [September 15, 2020, 2:09pm UTC](https://discuss.elastic.co/t/watcher-multiple-query-with-and-in-match/248691 "2020-09-15T14:09:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![suryanaj](https://avatars.discourse-cdn.com/v4/letter/s/ec9cab/32.png) [@suryanaj](https://discuss.elastic.co/u/suryanaj)\
**Post date:** [September 15, 2020, 2:09pm UTC](https://discuss.elastic.co/t/watcher-multiple-query-with-and-in-match/248691/1 "2020-09-15T14:09:02Z")

</div>

i am not getting any output and getting number match exception in output in 2nd query.  
Please suggest.

i want to use match like {  
"match": {  
"http.response.status\_code": "\<500 && \>599"  
}  
},

and want output but in output it says number format expression.

query  
{  
"trigger": {  
"schedule": {  
"interval": "2m"  
}  
},  
"input": {  
"chain": {  
"inputs": [  
{  
"first": {  
"search": {  
"request": {  
"search\_type": "query\_then\_fetch",  
"indices": [  
"heartbeat-_"  
],  
"types": [],  
"body": {  
"query": {  
"bool": {  
"must": [  
{  
"match\_phrase": {  
"http.url": "[https://nexus-amazon-uat.xyz.intranet/](https://nexus-amazon-uat.xyz.intranet/)"  
}  
},  
{  
"match": {  
"monitor.status": "up"  
}  
},  
{  
"range": {  
"@timestamp": {  
"gte": "now-28d"  
}  
}  
}  
]  
}  
},  
"\_source": [  
"message"  
]  
}  
}  
}  
}  
},  
{  
"second": {  
"search": {  
"request": {  
"search\_type": "query\_then\_fetch",  
"indices": [  
"heartbeat-_"  
],  
"types": ,  
"body": {  
"query": {  
"bool": {  
"must": [  
{  
"match\_phrase": {  
"http.url": "[https://nexus-amazon-uat.xyz.intranet/](https://nexus-amazon-uat.xyz.intranet/)"  
}  
},  
{  
"match": {  
"http.response.status\_code": "\<500 && \>599"  
}  
},  
{  
"range": {  
"@timestamp": {  
"gte": "now-28d"  
}  
}  
}  
]  
}  
},  
"\_source": [  
"message"  
]  
}  
}  
}  
}  
}  
]  
}  
},  
"condition": {  
"script": {  
"source": "ctx.vars.SLO\_percentage = ctx.payload.second.hits.total \* 100 / ctx.payload.first.hits.total; return ctx.vars.SLO\_percentage \<= 100",  
"lang": "painless"  
}  
},  
"actions": {  
"email\_administrator": {  
"email": {  
"profile": "standard",  
"from": "[noreply-ESaaS@xyz.com](mailto:noreply-ESaaS@xyz.com)",  
"to": [  
"[ajay@xyz.com](mailto:ajay@xyz.com)"  
],  
"subject": "ELASTIC STACK ALERT: SLO nexus V3 internal availability ([https://nexus-amazon-uat.xyz.intranet/](https://nexus-amazon-uat.xyz.intranet/)) - SLO breached {{ctx.vars.SLO\_percentage}} % Success )",  
"body": {  
"html": " **--Alerts Notification Details--**  
This alert triggered because a total of **{{ctx.payload.second.hits.total}}** Nexusv3 success hits and **{{ctx.payload.first.hits.total}}** nexusv3 total hits were found in the application within the last 28 days!"  
}  
}  
}  
},  
"metadata": {  
"app": "dxdt",  
"description": "Alert if status is down",  
"env": "DX DT/Nexusv3\_SLO UAT"  
},  
"throttle\_period\_in\_millis": 900000  
}

---

<div class="post-metadata">

**Author:** ![suryanaj](https://avatars.discourse-cdn.com/v4/letter/s/ec9cab/32.png) [@suryanaj](https://discuss.elastic.co/u/suryanaj)\
**Post date:** [September 16, 2020, 8:42am UTC](https://discuss.elastic.co/t/watcher-multiple-query-with-and-in-match/248691/2 "2020-09-16T08:42:13Z")

</div>

can someone please help on this.

---

<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:** [September 16, 2020, 9:46am UTC](https://discuss.elastic.co/t/watcher-multiple-query-with-and-in-match/248691/3 "2020-09-16T09:46:10Z")

</div>

This forum does not come with an SLA - so please be patient and do not bump your own threads after only 20h. If you need fast responses, there is [commercial support available via subscriptions](https://www.elastic.co/subscriptions).

Also, please refrain from messaging people privately.

Third, please take the time to properly format your snippets, the JSON above is super hard to read, while this forums allows for markdown, which has excellent support for code snippets.

Lastly, you may want to take a look at the [range query](https://www.elastic.co/guide/en/elasticsearch/reference/7.8/query-dsl-range-query.html).

---

<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 14, 2020, 9:46am UTC](https://discuss.elastic.co/t/watcher-multiple-query-with-and-in-match/248691/4 "2020-10-14T09:46:21Z")

</div>

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