Elasticsearch : How to delete an Index using python

Forgive me if this is quite basic but I have Python 2.7 and Elasticsearch 2.1.1 and I am just trying to delete an index using

    es.delete(index='researchtest', doc_type='test')

but this gives me

    return func(*args, params=params, **kwargs)
    TypeError: delete() takes at least 4 arguments (4 given)

I also tried

    es.delete_by_query(index='researchtest', doc_type='test',body='{"query":{"match_all":{}}}')

but I get

    AttributeError: 'Elasticsearch' object has no attribute 'delete_by_query'

Any idea why? Has the api changed for 2.1.1 for python?


From the docs, use this notation:

    from elasticsearch import Elasticsearch
    es = Elasticsearch()

    es.indices.delete(index='test-index', ignore=[400, 404])

From: stackoverflow.com/q/35134162