# 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/245373>\
**Category:** Elasticsearch\
**Created:** [August 18, 2020, 8:21am UTC](https://discuss.elastic.co/t/need-to-do-sum-aggregation-with-probable-null-values-of-field/245373 "2020-08-18T08:21:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![\_ite\_iew](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/_ite_iew/32/65296_2.png) [@\_ite\_iew](https://discuss.elastic.co/u/_ite_iew)\
**Post date:** [August 18, 2020, 8:21am UTC](https://discuss.elastic.co/t/need-to-do-sum-aggregation-with-probable-null-values-of-field/245373/1 "2020-08-18T08:21:26Z")

</div>

Hi,

I have a field in my elastic index with a 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

---

<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 15, 2020, 8:21am UTC](https://discuss.elastic.co/t/need-to-do-sum-aggregation-with-probable-null-values-of-field/245373/2 "2020-09-15T08:21:27Z")

</div>

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