def unwrap_filter(response, category):
    """
    Strips one layer of aggregations (named by <category>) from
    a ElasticSearch query response, leaving it still in proper ES
    response format.

    :param response: An Elasticsearch aggregation response dictionary.
    :param category: Name of the topmost aggregation in the response.
    :returns: The same response, with one level of aggregation removed.
    """

    unwrapped = response.copy()
    unwrapped['aggregations'] = response['aggregations'][category]

    return unwrapped