def _ensure_is_connected(self):
        if not self._is_connected:
            try:
                port = int(self.settings_dict['PORT'])
            except __HOLE__:
                raise ImproperlyConfigured("PORT must be an integer")

            self.db_name = self.settings_dict['NAME']

            self._connection = ES("%s:%s" % (self.settings_dict['HOST'], port),
                                  decoder=Decoder,
                                  encoder=Encoder,
                                  autorefresh=True,
                                  default_indices=[self.db_name])

            self._db_connection = self._connection
            #auto index creation: check if to remove
            try:
                self._connection.create_index(self.db_name)
            except:
                pass
            # We're done!
            self._is_connected = True
dataset/ETHPy150Open aparo/django-elasticsearch/django_elasticsearch/base.py/DatabaseWrapper._ensure_is_connected