Get the first/min date present in the index

def get_first_date_of_index(elastic_url, index):
    """Get the first/min date present in the index"""
    es = Elasticsearch(elastic_url)
    search = Search(using=es, index=index)
    agg = A("min", field="grimoire_creation_date")
    search.aggs.bucket("1", agg)
    search = search.extra(size=0)
    response = search.execute()
    start_date = response.to_dict()['aggregations']['1']['value_as_string'][:10]
    return start_date