def METHOD_NAME(document: JSON) -> JSON:
    """Utility function to return ES mappings by querying the Template
    database against a given index.
    Args:
        document : One of the values of ES_INTERNAL_INDEX_NAMES (JSON)
    Returns:
        JSON containing whitelisted keys of the index and corresponding
        values.
    """
    template = Template.find(document["index"])
    # Only keep the whitelisted fields
    return {
        "properties": {
            key: value
            for key, value in template.mappings["properties"].items()
            if key in document["whitelist"]
        }
    }