from typing import Dict


def get_fields(index_dict: Dict) -> Dict:
    """
    :param index_dict: Elasticsearch index mapping
    :return: simplified dictionary of structure with keys are field names and values as types
    """
    ret_dict = {}
    for key, value in index_dict.items():
        if "properties" in value:
            ret_dict[key] = get_fields(value["properties"])
        elif "type" in value:
            ret_dict[key] = value["type"]
        else:
            print(f"unrecognised key: {key}")
    return ret_dict