# Sum aggregate of field stored in non integer data type

**URL:** <https://discuss.elastic.co/t/sum-aggregate-of-field-stored-in-non-integer-data-type/198747>\
**Category:** Elasticsearch\
**Created:** [September 9, 2019, 4:48pm UTC](https://discuss.elastic.co/t/sum-aggregate-of-field-stored-in-non-integer-data-type/198747 "2019-09-09T16:48:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hashdappcoder](https://avatars.discourse-cdn.com/v4/letter/h/59ef9b/32.png) [@hashdappcoder](https://discuss.elastic.co/u/hashdappcoder)\
**Post date:** [September 9, 2019, 4:48pm UTC](https://discuss.elastic.co/t/sum-aggregate-of-field-stored-in-non-integer-data-type/198747/1 "2019-09-09T16:48:09Z")

</div>

Hi Team,

I am working on a data set where a number is 32 bytes with max value 2 ^ 256 -1. I cant store this into Integer data type.

How can I run sum aggregation on this field? In below example `_tokenAmount` is that field for this instance.

Sample data

{  
"\_index": "bounty\_network",  
"\_type": "\_doc",  
"\_id": "0xdfca7d9cb54e5f91282ce1c07f52240e2421c9e1c97dec848ffe83b78b055b0e-136",  
"\_version": 8,  
"\_score": 0,  
"\_source": {  
"\_\_typename": "FulfillmentAccepted",  
"\_approver": "0xd8d149e288273b35c633afc0f825ef273e2f1257",  
"\_bountyId": "18",  
"\_fulfillmentId": "26",  
"\_tokenAmount": "250000000000000000"  
,  
"blockNumber": "8274948"  
},  
"highlight": {  
"\_\_typename": [  
"@kibana-highlighted-field@FulfillmentAccepted@/kibana-highlighted-field@"  
]  
}  
}

---

<div class="post-metadata">

**Author:** ![quilldata](https://avatars.discourse-cdn.com/v4/letter/q/898d66/32.png) [@quilldata](https://discuss.elastic.co/u/quilldata)\
**Post date:** [September 10, 2019, 4:25am UTC](https://discuss.elastic.co/t/sum-aggregate-of-field-stored-in-non-integer-data-type/198747/2 "2019-09-10T04:25:00Z")

</div>

I am also facing similar issue.  
Trying to index token amount which is fetched from ethereum in ElasticSearch but getting below exception:

Caused by: java.lang.IllegalArgumentException: Value [2000000000000000000000] is out of range for a long  
at org.elasticsearch.common.xcontent.support.AbstractXContentParser.toLong(AbstractXContentParser.java:177) ~[elasticsearch-x-content-7.3.1.jar:7.3.1]

Not sure how to proceed. Can someone please help?

---

<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 8, 2019, 4:25am UTC](https://discuss.elastic.co/t/sum-aggregate-of-field-stored-in-non-integer-data-type/198747/3 "2019-10-08T04:25:03Z")

</div>

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