code: def reset_elasticsearch(self):
          
  
          print("""
  Cleanup Elasticsearch database:
      This will truncate all tables and reset the whole Elasticsearch database.
                """)
  
          confirm = self.no_confirm
  
          if not confirm:
              confirm = 'yes' in builtins.input(
                  """
  Do you really want to do this? Write 'yes' to confirm: {yes}"""
                      .format(yes='yes' if confirm else ''))
  
          if not confirm:
              print("Did not type yes. Thus aborting.")
              return
  
          try:
              # initialize DB connection
              es = Elasticsearch([self.elasticsearch["host"]],
                                 http_auth=(self.elasticsearch["username"], self.elasticsearch["secret"]),
                                 port=self.elasticsearch["port"],
                                 use_ssl=self.elasticsearch["use_ca_certificates"],
                                 verify_certs=self.elasticsearch["use_ca_certificates"],
                                 ca_certs=self.elasticsearch["ca_cert_path"],
                                 client_cert=self.elasticsearch["client_cert_path"],
                                 client_key=self.elasticsearch["client_key_path"])
  
              print("Resetting Elasticsearch database...")
              es.indices.delete(index=self.elasticsearch["index_current"], ignore=[400, 404])
              es.indices.delete(index=self.elasticsearch["index_archive"], ignore=[400, 404])
          except ConnectionError as error:
              self.log.error("Failed to connect to Elasticsearch. "
                             "Please check if the database is running and the config is correct: %s" % error)
docs: Resets the Elasticsearch Database.