# Ctx.payload.hits.total returns me zero, why?

**URL:** <https://discuss.elastic.co/t/ctx-payload-hits-total-returns-me-zero-why/50359>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [May 18, 2016, 3:32pm UTC](https://discuss.elastic.co/t/ctx-payload-hits-total-returns-me-zero-why/50359 "2016-05-18T15:32:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abdellah\_Bouhoudane](https://avatars.discourse-cdn.com/v4/letter/a/839c29/32.png) [@Abdellah\_Bouhoudane](https://discuss.elastic.co/u/Abdellah_Bouhoudane)\
**Post date:** [May 18, 2016, 3:32pm UTC](https://discuss.elastic.co/t/ctx-payload-hits-total-returns-me-zero-why/50359/1 "2016-05-18T15:32:29Z")

</div>

This is my Watch, for some reason ctx.payload.hits.total returns zero

curl -XPUT '[http://172.17.0.2:9200/\_watcher/watch/ehackb\_watch19](http://172.17.0.2:9200/_watcher/watch/ehackb_watch19)' -d '  
{  
"trigger": {  
"schedule": { "interval" : "15s"}  
},  
"input" : {  
"search" : {  
"request" : {  
"indices" : ["capi"],  
"types" : ["generics"],  
"body" : {  
"query" : {  
"match" : {"[data.to.name](http://data.to.name)":"crm@person-get"}  
}  
}  
}  
}  
},  
"condition": {  
"compare" : {  
"ctx.payload.hits.total" : {  
"gt":0  
}  
}  
},  
"actions" : {  
"send\_email" : {  
"email" : {  
"to" : "lim\_le\_kamelancien@hotmail.com",  
"subject" : "Alert",  
"body" : "No data being received"  
}  
}  
}  
}'

---

<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 20, 2016, 7:24am UTC](https://discuss.elastic.co/t/ctx-payload-hits-total-returns-me-zero-why/50359/2 "2016-05-20T07:24:38Z")

</div>

Hey

does the query return any hits, if you execute it manually and standalone?

--Alex

---

<div class="post-metadata">

**Author:** ![Abdellah\_Bouhoudane](https://avatars.discourse-cdn.com/v4/letter/a/839c29/32.png) [@Abdellah\_Bouhoudane](https://discuss.elastic.co/u/Abdellah_Bouhoudane)\
**Post date:** [May 20, 2016, 3:31pm UTC](https://discuss.elastic.co/t/ctx-payload-hits-total-returns-me-zero-why/50359/3 "2016-05-20T15:31:40Z")

</div>

Yes, i found my problem thank you very much

My problem was the "types " field, i removed it and it's working now !

---

<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/ctx-payload-hits-total-returns-me-zero-why/50359/4 "2017-07-06T13:45:31Z")

</div>


