So I have a Python script which uses my ElasticSearch login to list indicies with doc.count 0
I have managed to list the indicies with doc.count 0 successfully.

Deleting these indicies is tricky.

Here part of the script:

# List indices with doc.count 0
for index in content:
    indiciesList = index
    collectdoccount = index['docs.count']
    search_int = int(collectdoccount)
    if search_int == 0:
       print(index['index'] , index['docs.count'])
       index_name = index['index']
       delete_url = f"https://{ELASTIC_SEARCH_URL}/{url_ending_deletion}/{index_name}"
       action_delete = requests.delete(delete_url)
    if  response.status_code == 200:
        print(index['index'] , index['docs.count'])
    if response.status_code != 200:
       print (index['index'] , "index not deleted")

The error I get is requests.status_codes(action_delete)

TypeError: 'module' object is not callable

Do you know what I need to do to resolve this?

New contributor

JonH is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.