1

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?

1 Answer 1

1

You can use the min_doc_count setting for this:

.aggregation( 
        AggregationBuilders.terms("aggs")
             .field( "oid")
             .minDocCount(10)                 <----- add this
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.