public void facetFilterOnTermFacet() throws Exception {
TermsFacetBuilder facet = FacetBuilders.termsFacet("f")
.field("brand")
.facetFilter(FilterBuilders.termFilter("colour", "pale"));
TermsFacet f = (TermsFacet) launchSearch(facet, "f");
f.getTotalCount(); // Total terms doc count
f.getOtherCount(); // Not shown terms doc count
f.getMissingCount(); // Without term doc count
// For each entry
for (TermsFacet.Entry entry : f) {
entry.getTerm(); // Term
entry.getCount(); // Doc count