'Adds stats facet for the given field and facet_fields represents
the faceted fields.'

def stats_facet(self, field, facet_fields=None):

    clone = self._clone()
    stats_facets = []
    try:
        stats_facets.append(sum(facet_fields, []))
    except TypeError:
        if facet_fields:
            stats_facets.append(facet_fields)
    clone.query.add_stats_query(field, stats_facets)
    return clone
