def delete_if_exists(self): es = WikiDocumentType.get_connection() try: es.indices.delete(self.prefixed_name) except NotFoundError: # Can ignore this since it indicates the index doesn't exist # and therefore there's nothing to delete. pass