code: def default_facets_factory(search, index):
      
      urlkwargs = MultiDict()
  
      facets = current_app.config['RECORDS_REST_FACETS'].get(index)
  
      if facets is not None:
          # Aggregations.
          search = _aggregations(search, facets.get("aggs", {}))
  
          # Query filter
          search, urlkwargs = _query_filter(
              search, urlkwargs, facets.get("filters", {}))
  
          # Post filter
          search, urlkwargs = _post_filter(
              search, urlkwargs, facets.get("post_filters", {}))
  
      return (search, urlkwargs)
docs: Add a default facets to query.
  
      :param search: Basic search object.
      :param index: Index name.
      :returns: A tuple containing the new search object and a dictionary with
          all fields and values used.