# Need to do sum aggregation with probable null values of field

**URL:** <https://discuss.elastic.co/t/need-to-do-sum-aggregation-with-probable-null-values-of-field/172971>\
**Category:** Elasticsearch\
**Created:** [March 19, 2019, 12:54pm UTC](https://discuss.elastic.co/t/need-to-do-sum-aggregation-with-probable-null-values-of-field/172971 "2019-03-19T12:54:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lasitha1991](https://avatars.discourse-cdn.com/v4/letter/l/6de8d8/32.png) [@lasitha1991](https://discuss.elastic.co/u/lasitha1991)\
**Post date:** [March 19, 2019, 12:54pm UTC](https://discuss.elastic.co/t/need-to-do-sum-aggregation-with-probable-null-values-of-field/172971/1 "2019-03-19T12:54:32Z")

</div>

Hi,

I have a field in my elastic index with probable null value for that field.

But when I do sum aggregation on that field, even with all the values as null it returns 0 as the value from elasticsearch.

I need to have the output as null, when all the documents have null values for that field. Is there a way to achieve this using elasticsearch.

Thanks,  
-Lasitha Weerasinghe

---

<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:** [April 16, 2019, 1:04pm UTC](https://discuss.elastic.co/t/need-to-do-sum-aggregation-with-probable-null-values-of-field/172971/2 "2019-04-16T13:04:36Z")

</div>

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