# Not able to do sum operation (Sum operation getting error)

**URL:** <https://discuss.elastic.co/t/not-able-to-do-sum-operation-sum-operation-getting-error/247262>\
**Category:** Elasticsearch\
**Created:** [September 2, 2020, 4:07pm UTC](https://discuss.elastic.co/t/not-able-to-do-sum-operation-sum-operation-getting-error/247262 "2020-09-02T16:07:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Moksha20](https://avatars.discourse-cdn.com/v4/letter/m/779978/32.png) [@Moksha20](https://discuss.elastic.co/u/Moksha20)\
**Post date:** [September 2, 2020, 4:07pm UTC](https://discuss.elastic.co/t/not-able-to-do-sum-operation-sum-operation-getting-error/247262/1 "2020-09-02T16:07:54Z")

</div>

Hi ,

Recently I have migrated to grafana 7.0+ .The same query I used to run previously is not running now.

Sample JSON LOG:

```auto
<2020-07-31 06:31:56>:<Item_Des_doc_id>:<High>:<Pen>:<Datbase>:<location>:<Item_Des>:<Item_Id>:<2020-07-31 02:05:44>:<Xy>:<Xy>:<100>
<2020-07-31 06:31:56>:<Item_Des_doc_id>:<High>:<pencil>:<Datbase>:<location>:<Item_Des>:<Item_Id>:<2020-07-31 02:05:44>:<Xy>:<Xy>:<100>

```

Sample JSON Pattern:  
"\<%{TIMESTAMP\_ISO8601:date}\>:\<%{DATA:document\_id}\>:\<%{DATA:Cat}\>:\<%{DATA:item}\>:\<%{DATA:database}\>:\<%{DATA:location}\>:\<%{DATA:Item\_Des}\>:\<%{NUMBER:Item\_Id}\>:\<%{TIMESTAMP\_ISO8601:Timestamp}\>:\<%{DATA:brand\_type}\>:\<%{DATA:brand\_CATEGORY}\>:\<%{DATA:totrec}\>"

Objective: based on brand\_type I want to sum totrec with grouping the item.

The issue is regrading to perform sum on one of my field.  
The previous setup that worked fine:

 ![work](https://us1.discourse-cdn.com/elastic/original/3X/f/3/f3755972dcb5a21ce0e312c12fb48bba4d0dc7d9.png)

After Upgrade:

 ![work](https://us1.discourse-cdn.com/elastic/original/3X/f/3/f3755972dcb5a21ce0e312c12fb48bba4d0dc7d9.png)

After upgrade I tried below but got error as “Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [totrec] in order to load field data by uninverting the inverted index. Note that this can use significant memory.”

So I tried with keyword option and I am getting error as **“Field [totrec.keyword] of type [keyword(indexed,omitNorms,indexOptions=DOCS)] is not supported for aggregation**  
**[sum]”**

 ![error 2](https://us1.discourse-cdn.com/elastic/original/3X/2/f/2f6955bd237397f130771def0acf07eb4875b24b.jpeg)

I tried to set it as fielddate= true but then I am getting same above error

Could anyone help me please.

---

<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 30, 2020, 4:07pm UTC](https://discuss.elastic.co/t/not-able-to-do-sum-operation-sum-operation-getting-error/247262/2 "2020-09-30T16:07:56Z")

</div>

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