def terms(self, facet_name, field, size=10, order=None, all_terms=False, exclude=[], regex='', regex_flags=''):
        '''
        Allow to specify field facets that return the N most frequent terms.

        Ordering: Allow to control the ordering of the terms facets, to be ordered by count, term, reverse_count or reverse_term. The default is count.
        All Terms: Allow to get all the terms in the terms facet, ones that do not match a hit, will have a count of 0. Note, this should not be used with fields that have many terms.
        Excluding Terms: It is possible to specify a set of terms that should be excluded from the terms facet request result.
        Regex Patterns: The terms API allows to define regex expression that will control which terms will be included in the faceted list.
        '''

        self[facet_name] = dict(terms=dict(field=field, size=size))
        if order:
            self[facet_name][terms]['order'] = order
        if all_terms:
            self[facet_name][terms]['all_terms'] = True
        if exclude:
            self[facet_name][terms]['exclude'] = exclude
        if regex:
            self[facet_name][terms]['regex'] = regex
        if regex_flags:
            self[facet_name][terms]['regex_flags'] = regex_flags

        return self
Allow to specify field facets that return the N most frequent terms.

        Ordering: Allow to control the ordering of the terms facets, to be ordered by count, term, reverse_count or reverse_term. The default is count.
        All Terms: Allow to get all the terms in the terms facet, ones that do not match a hit, will have a count of 0. Note, this should not be used with fields that have many terms.
        Excluding Terms: It is possible to specify a set of terms that should be excluded from the terms facet request result.
        Regex Patterns: The terms API allows to define regex expression that will control which terms will be included in the faceted list.