Ordering terms in term aggregation in the new Java API Client

    .terms(term -> term
        .field("doc_type")
        .size(50)
        .minDocCount(1)
        .showTermDocCountError(false)
        .order(NamedValue.of("_count", SortOrder.Asc), NamedValue.of("_key", SortOrder.Asc))
    )
1 Like