Significant terms aggregation percentage parameter not working


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?


(Mark Walkom) #2

It'd be easier if you can paste what you have :slight_smile:

(Mark Harwood) #3

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.


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

(system) #5