# "term\_stats" equivalent in aggregations? (ES 1.0)

**URL:** <https://discuss.elastic.co/t/term-stats-equivalent-in-aggregations-es-1-0/15788>\
**Category:** Elasticsearch\
**Created:** [February 13, 2014, 7:02pm UTC](https://discuss.elastic.co/t/term-stats-equivalent-in-aggregations-es-1-0/15788 "2014-02-13T19:02:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eric\_Nelson](https://avatars.discourse-cdn.com/v4/letter/e/f475e1/32.png) [@Eric\_Nelson](https://discuss.elastic.co/u/Eric_Nelson)\
**Post date:** [February 13, 2014, 7:02pm UTC](https://discuss.elastic.co/t/term-stats-equivalent-in-aggregations-es-1-0/15788/1 "2014-02-13T19:02:45Z")

</div>

Hi all. LOVE the new 1.0 release, and learning about the new aggregation  
framework. Can you tell me if there is an aggregation equivalent to the  
term\_stats facet? The term aggregation isn't quite the same. I want to  
bucket on one field, and calculate stats on another. Any help on this would  
be greatly appreciated.

--Eric

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/a2a4286e-18ac-4e2b-906f-2279dd915512%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a2a4286e-18ac-4e2b-906f-2279dd915512%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Binh\_Ly](https://avatars.discourse-cdn.com/v4/letter/b/ce7236/32.png) [@Binh\_Ly](https://discuss.elastic.co/u/Binh_Ly)\
**Post date:** [February 13, 2014, 7:18pm UTC](https://discuss.elastic.co/t/term-stats-equivalent-in-aggregations-es-1-0/15788/2 "2014-02-13T19:18:37Z")

</div>

You should be able to do a stats sub under terms like this:

{  
"aggs": {  
"terms": {  
"terms": {  
"field": "term\_field"  
},  
"aggs": {  
"stats": {  
"stats": {  
"field": "stats\_field"  
}  
}  
}  
}  
}  
}

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/fef0784b-5c62-4952-8c04-2ccaa023af2a%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/fef0784b-5c62-4952-8c04-2ccaa023af2a%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Eric\_Nelson](https://avatars.discourse-cdn.com/v4/letter/e/f475e1/32.png) [@Eric\_Nelson](https://discuss.elastic.co/u/Eric_Nelson)\
**Post date:** [February 13, 2014, 7:55pm UTC](https://discuss.elastic.co/t/term-stats-equivalent-in-aggregations-es-1-0/15788/3 "2014-02-13T19:55:07Z")

</div>

Perfect! Thanks Binh.

---Eric

On Thursday, February 13, 2014 12:18:37 PM UTC-7, Binh Ly wrote:

> You should be able to do a stats sub under terms like this:
> 
> {  
> "aggs": {  
> "terms": {  
> "terms": {  
> "field": "term\_field"  
> },  
> "aggs": {  
> "stats": {  
> "stats": {  
> "field": "stats\_field"  
> }  
> }  
> }  
> }  
> }  
> }

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/c3cfac2f-4002-4762-94d2-aa805fe01674%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/c3cfac2f-4002-4762-94d2-aa805fe01674%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 1:50am UTC](https://discuss.elastic.co/t/term-stats-equivalent-in-aggregations-es-1-0/15788/4 "2017-07-06T01:50:24Z")

</div>


