code: def pivot_query(facet=None, facet_pivot_fields=None, **kwargs):
      
      if facet_pivot_fields is None:
          facet_pivot_fields = []
      results = search_associations(rows=0,
                                    facet_fields=[facet],
                                    #facet_pivot_fields=facet_pivot_fields + [facet],
                                    facet_pivot_fields=facet_pivot_fields,
                                    **kwargs)
      return results
docs: Pivot query