def _get_column_headers_and_names(document_source, column_mapping):
    """
    Creates ordered lists of column headers (the 'titles of the columns), and column names (the name of the fields in
    the ElasticSearch results, given the column mapping.

    So, for example, given the following column_mapping:
    {
      "עיר": "address.city"
      "תקציב": "details.budget"
    }
    The returned values will be:
    - column_headers: ['עיר', 'תקציב']
    - column_names: ['address.city', 'details.budget']

    If there is no column_mapping sent, the column_headers will be the same as the column_names

    :param document_source: A single document from the Elasticsearch search result
    :param column_mapping (dict): A dict mapping the column names in the original data, to the desired column headers
    for the output file (see example above)

    :return (tuple): A tuple consisting of column_headers and column_names, both lists (see example above)
    """

    # In case of column mapping, set the order of the columns and then get the headers list and the names list
    if column_mapping:
        ordered_columns = [(field, column_mapping[field]) for field in column_mapping]
        column_headers = [(field[1]) for field in ordered_columns]
        column_names = [(field[0]) for field in ordered_columns]

    # If no column_mapping is sent, simply set the order, and the column_names are the same as the column_headers
    else:
        column_headers = [field for field in document_source]
        column_names = column_headers

    return column_headers, column_names