def delete_index(self, index_name): if not isinstance(index_name, unicode): Log.error("expecting an index name") if self.debug: Log.note("Deleting index {{index}}", index=index_name) # REMOVE ALL ALIASES TOO aliases = [a for a in self.get_aliases() if a.index == index_name and a.alias != None] if aliases: self.post( path="/_aliases", data={"actions": [{"remove": a} for a in aliases]} ) url = self.settings.host + ":" + unicode(self.settings.port) + "/" + index_name try: response = http.delete(url) if response.status_code != 200: Log.error("Expecting a 200") details = convert.json2value(utf82unicode(response.content)) if self.debug: Log.note("delete response {{response}}", response=details) return response except Exception, e: Log.error("Problem with call to {{url}}", url=url, cause=e)
def delete_index(self, index_name): if not isinstance(index_name, unicode): Log.error("expecting an index name") if self.debug: Log.note("Deleting index {{index}}", index=index_name) # REMOVE ALL ALIASES TOO aliases = [a for a in self.get_aliases() if a.index == index_name and a.alias != None] if aliases: self.post( path="/_aliases", data={"actions": [{"remove": a} for a in aliases]} ) url = self.settings.host + ":" + unicode(self.settings.port) + "/" + index_name try: response = http.delete(url) if response.status_code != 200: Log.error("Expecting a 200, got {{code}}", code=response.status_code) details = mo_json.json2value(utf82unicode(response.content)) if self.debug: Log.note("delete response {{response}}", response=details) return response except Exception, e: Log.error("Problem with call to {{url}}", url=url, cause=e)
def delete(self, path, **kwargs): url = self.settings.host + ":" + unicode(self.settings.port) + path try: response = convert.json2value(utf82unicode(http.delete(url, **kwargs).content)) if self.debug: Log.note("delete response {{response}}", response= response) return response except Exception, e: Log.error("Problem with call to {{url}}", url= url, cause=e)
def delete(self, path, **kwargs): url = self.settings.host + ":" + unicode(self.settings.port) + path try: response = convert.json2value( utf82unicode(http.delete(url, **kwargs).content)) if self.debug: Log.note("delete response {{response}}", response=response) return response except Exception, e: Log.error("Problem with call to {{url}}", url=url, cause=e)
def delete(self, path, **kwargs): url = self.settings.host + ":" + unicode(self.settings.port) + path try: response = http.delete(url, **kwargs) if response.status_code not in [200]: Log.error(response.reason+": "+response.all_content) if self.debug: Log.note("response: {{response}}", response=strings.limit(utf82unicode(response.all_content), 130)) details = wrap(convert.json2value(utf82unicode(response.all_content))) if details.error: Log.error(details.error) return details except Exception, e: Log.error("Problem with call to {{url}}", url=url, cause=e)
def delete(self, path, **kwargs): url = self.settings.host + ":" + unicode(self.settings.port) + path try: response = http.delete(url, **kwargs) if response.status_code not in [200]: Log.error(response.reason+": "+response.all_content) if self.debug: Log.note("response: {{response}}", response=strings.limit(utf82unicode(response.all_content), 130)) details = wrap(mo_json.json2value(utf82unicode(response.all_content))) if details.error: Log.error(details.error) return details except Exception, e: Log.error("Problem with call to {{url}}", url=url, cause=e)