4 examples of 'elasticsearch delete index' in Python

Every line of 'elasticsearch delete index' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
203def index_delete(self, index):
204 '''
205 Delets the specified index
206 > search = ElasticSearch()
207 > search.index_delete('twitter')
208 {"ok" : True, "acknowledged" : True }
209 '''
210 request = self.session
211 url = 'http://%s:%s/%s' % (self.host, self.port, index)
212 response = request.delete(url)
213 return response

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

167@query_params('allow_no_indices', 'expand_wildcards', 'ignore_unavailable',
168 'master_timeout', 'timeout')
169def delete(self, index, params=None):
170 """
171 Delete an index in Elasticsearch
172 `<http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-delete-index.html>`_
174 :arg index: A comma-separated list of indices to delete; use `_all` or
175 `*` string to delete all indices
176 :arg allow_no_indices: Ignore if a wildcard expression resolves to no
177 concrete indices (default: false)
178 :arg expand_wildcards: Whether wildcard expressions should get expanded
179 to open or closed indices (default: open), default 'open', valid
180 choices are: 'open', 'closed', 'none', 'all'
181 :arg ignore_unavailable: Ignore unavailable indexes (default: false)
182 :arg master_timeout: Specify timeout for connection to master
183 :arg timeout: Explicit operation timeout
184 """
185 if index in SKIP_IN_PATH:
186 raise ValueError("Empty value passed for a required argument 'index'.")
187 return self.transport.perform_request('DELETE', _make_path(index),
188 params=params)
91def delete(self, **kwargs):
92 "Delete document not delete index."
93 kw = dict(index=self.name, doc_type=self.doc_type, ignore=[404])
94 kw.update(**kwargs)
95 return self._client.delete(**kw)
87def delete_index(index_name):
88 es = connect()
89 return es.indices.delete(index_name, ignore=[400, 404])

Related snippets