Elasticsearch: Cómo eliminar un índice usando python


Perdóname si esto es bastante básico, pero tengo Python 2.7 y Elasticsearch 2.1.1 y solo estoy tratando de eliminar un índice usando

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

Pero esto me da

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

También intenté

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

Pero consigo

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

¿Alguna idea de por qué? ¿Ha cambiado la api para 2.1.1 para python?

Https://elasticsearch-py.readthedocs.org/en/master/api.html#elasticsearch.client.IndicesClient.delete

Author: Alex Alifimoff, 2016-02-01

1 answers

De los documentos, use esta notación:

from elasticsearch import Elasticsearch
es = Elasticsearch()

es.indices.delete(index='test-index', ignore=[400, 404])
 53
Author: ferdy,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-02-01 15:33:14