# Significant terms aggregation percentage parameter not working

**URL:** <https://discuss.elastic.co/t/significant-terms-aggregation-percentage-parameter-not-working/23779>\
**Category:** Elasticsearch\
**Created:** [June 16, 2015, 6:49pm UTC](https://discuss.elastic.co/t/significant-terms-aggregation-percentage-parameter-not-working/23779 "2015-06-16T18:49:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![buck](https://avatars.discourse-cdn.com/v4/letter/b/c5a1d2/32.png) [@buck](https://discuss.elastic.co/u/buck)\
**Post date:** [June 16, 2015, 6:49pm UTC](https://discuss.elastic.co/t/significant-terms-aggregation-percentage-parameter-not-working/23779/1 "2015-06-16T18:49:15Z")

</div>

I've tried passing the "percentage": {} parameter in all logical places within my aggregation query. The significant terms aggregation alone works fine, but when I add the percentage parameter (or any other for that matter) it keeps throwing parsing errors. I can't seem to find any examples of this online, and the documentation (pasted below) leaves lots to the imagination. Does anyone have experience with this?

Thanks,  
Buck

 ![](https://us1.discourse-cdn.com/elastic/original/2X/c/c84d1f101e630ddfbddebcbb83fdcc5c231f78f4.png)

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [June 17, 2015, 4:21am UTC](https://discuss.elastic.co/t/significant-terms-aggregation-percentage-parameter-not-working/23779/2 "2015-06-17T04:21:32Z")

</div>

It'd be easier if you can paste what you have 🙂

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [June 17, 2015, 8:43am UTC](https://discuss.elastic.co/t/significant-terms-aggregation-percentage-parameter-not-working/23779/3 "2015-06-17T08:43:42Z")

</div>

As a parameter to the significant\_terms aggregation it should sit alongside all the other parameters at the same level as "field", "size" etc  
"Percentage" is a recently-added heuristic so you may need to check the elasticsearch version.  
A scripted heuristic can be used to do the simple calculation if you are on an older version.

---

<div class="post-metadata">

**Author:** ![buck](https://avatars.discourse-cdn.com/v4/letter/b/c5a1d2/32.png) [@buck](https://discuss.elastic.co/u/buck)\
**Post date:** [June 17, 2015, 3:30pm UTC](https://discuss.elastic.co/t/significant-terms-aggregation-percentage-parameter-not-working/23779/4 "2015-06-17T15:30:07Z")

</div>

Where would the parameter go in this example?

{  
"aggregations": {  
"filtered\_agg": {  
"filter": {"and": [{"term": {"advertisementInformation.isForSale":  
true}}, {"exists": {"field": "productDetails"}}]},  
"aggregations": {  
"stock\_type\_agg": {  
"significant\_terms": {  
"field": "advertisementInformation.stockType",  
"size": 0  
}  
}  
}  
}  
}  
}

---

<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, 12:07am UTC](https://discuss.elastic.co/t/significant-terms-aggregation-percentage-parameter-not-working/23779/5 "2017-07-06T00:07:00Z")

</div>


