Reputation: 3053
I would like to make query that like 'sql having' in ES java api.
select * from table group by oid having count(1) > 10
Here is I made but cannot add filter method.
.aggregation(
AggregationBuilders.terms( "aggs").field( "oid").filter... // cannot add filter method
Should I use .script for this?
Upvotes: 1
Views: 71
Reputation: 217564
You can use the min_doc_count
setting for this:
.aggregation(
AggregationBuilders.terms("aggs")
.field( "oid")
.minDocCount(10) <----- add this
Upvotes: 1