# Payload total and output value do not match

**URL:** https://discuss.elastic.co/t/payload-total-and-output-value-do-not-match/195564
**Category:** Elasticsearch
**Tags:** elastic-stack-alerting
**Created:** [August 16, 2019, 9:19pm UTC](https://discuss.elastic.co/t/payload-total-and-output-value-do-not-match/195564 "2019-08-16T21:19:36Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Shaw](https://avatars.discourse-cdn.com/v4/letter/s/5e9695/32.png) [@Shaw](https://discuss.elastic.co/u/Shaw)
#### Post date: [August 16, 2019, 9:19pm UTC](https://discuss.elastic.co/t/payload-total-and-output-value-do-not-match/195564/1 "2019-08-16T21:19:36Z")

</div>

Hi,

When I setup a new Watcher, the payload total has like 38 records but the output result only gives 10, even refresh every time with different total the output stays 10, is it because the Simulation Results only give 10 max? Please advice.

_ **Partial Script** _  
...  
"condition": {  
"compare": {  
"ctx.payload.hits.total": {  
"gte": 1  
}  
}  
},  
"actions": {  
"send\_email": {  
"transform": {  
"script": {  
"source": "def userhost= ctx.payload.hits.hits.stream().map(hit -\> 'User: ' + hit.\_source['user'] + ' - Hostname: ' + hit.\_source['hostname']).collect(Collectors.toList()); userhost.add(' Total: ' + userhost.length); return userhost;",  
"lang": "painless"  
...

_ **Simulated Result** _  
...  
"ctx.payload.hits.total": 38  
}  
}  
},  
"actions": [  
{  
"id": "send\_email",  
"type": "email",  
"status": "simulated",  
"transform": {  
"type": "script",  
"status": "success",  
"payload": {  
"\_value": [  
"User: xxx - Hostname: xxx",  
...  
" Total: 10"  
]

---

<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: [August 19, 2019, 7:21am UTC](https://discuss.elastic.co/t/payload-total-and-output-value-do-not-match/195564/2 "2019-08-19T07:21:48Z")

</div>

Hey,

by default elasticsearch only returns the first ten results. If you want to change this behaviour, you need to tweak the [size parameter](https://www.elastic.co/guide/en/elasticsearch/reference/7.3/search-request-body.html#request-body-search-from-size) of a search request.

--Alex

---

<div class="post-metadata">

### Author: ![Shaw](https://avatars.discourse-cdn.com/v4/letter/s/5e9695/32.png) [@Shaw](https://discuss.elastic.co/u/Shaw)
#### Post date: [August 19, 2019, 4:19pm UTC](https://discuss.elastic.co/t/payload-total-and-output-value-do-not-match/195564/3 "2019-08-19T16:19:05Z")

</div>

> [@spinscale](#):
>
> by default elasticsearch only returns the first ten results. If you want to change this behaviour, you need to tweak the [size parameter](https://www.elastic.co/guide/en/elasticsearch/reference/7.3/search-request-body.html#request-body-search-from-size) of a search request.

Thank you @spinscale. Your suggestion works!

---

<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: [September 16, 2019, 4:19pm UTC](https://discuss.elastic.co/t/payload-total-and-output-value-do-not-match/195564/4 "2019-09-16T16:19:28Z")

</div>

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