# Term Stats Facet for Array of Fields showing Wrong Total

**URL:** <https://discuss.elastic.co/t/term-stats-facet-for-array-of-fields-showing-wrong-total/8930>\
**Category:** Elasticsearch\
**Created:** [September 5, 2012, 7:19am UTC](https://discuss.elastic.co/t/term-stats-facet-for-array-of-fields-showing-wrong-total/8930 "2012-09-05T07:19:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vijuitech](https://avatars.discourse-cdn.com/v4/letter/v/bcef8e/32.png) [@vijuitech](https://discuss.elastic.co/u/vijuitech)\
**Post date:** [September 5, 2012, 7:19am UTC](https://discuss.elastic.co/t/term-stats-facet-for-array-of-fields-showing-wrong-total/8930/1 "2012-09-05T07:19:16Z")

</div>

Hi,  
I am using the Term stats Facet for getting the Total for  
the set of Prominence values of different stake ID in Array of  
fields.

"fields" : {  
"stakedetailsarray.stakeprominence" : [ 30.83, 30.83, 30.83,  
30.83 ],  
"stakedetailsarray.stakeid" : [1, 6, 8, 9],  
}

"fields" : {  
"stakedetailsarray.stakeprominence" : [30.83, 30.83],  
"stakedetailsarray.stakeid" : [1, 6],  
}

"fields" : {  
"stakedetailsarray.stakeprominence" : [ 38.33, 30.83, 46.0,  
30.83 ],  
"stakedetailsarray.stakeid" : [1, 4, 5, 7],  
}

"fields" : {  
"stakedetailsarray.stakeprominence" : [24.17, 24.0, 24.17],  
"stakedetailsarray.stakeid" : [4, 5, 7],  
}

"fields" : {

```
    "stakedetailsarray.stakeprominence" : [24.17, 24.0, 24.17],
    "stakedetailsarray.stakeid" : [4, 5, 7],

```

}  
"fields" : {

```
   stakedetailsarray.stakeprominence" : [31.67, 24.0, 24.17],
    "stakedetailsarray.stakeid" : [1, 5, 6],

```

}

:  
:  
"facets" : {  
"common" : {  
"\_type" : "terms\_stats",  
{  
"term" : 7,  
"count" : 3,  
"total\_count" : 7,  
"min" : 24.0,  
"max" : 46.0,  
"total" : 211.5,  
"mean" : 30.214285714285715  
}, {  
"term" : 6,  
"count" : 3,  
"total\_count" : 5,  
"min" : 24.0,  
"max" : 31.67,  
"total" : 141.5,  
"mean" : 28.3  
},

In this I got the Count as correct value . The Total Value is getting  
wrong,

The total for term 6 is 85.83, but it is showing as 141.5.

The total for term 7 is 79.17, but it is showing as 211.5.

How can I get the correct total for the Terms?

--

---

<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:** [July 6, 2017, 3:14am UTC](https://discuss.elastic.co/t/term-stats-facet-for-array-of-fields-showing-wrong-total/8930/2 "2017-07-06T03:14:05Z")

</div>


