def convert_search_to_dictionary(search):
    """ Converts the given search to a dictionary. Useful in mocking queries from dictionaries in testing.

    :param search: elasticsearch_dsl object to convert
    :return: query in dictionary form
    """
    return search.to_dict()