def __init__(self, index, doc_type='_doc', es_host='localhost:9200',
                 step=500, step_size=10,  # elasticsearch.helpers.bulk
                 number_of_shards=1, number_of_replicas=0,
                 check_index=True, **kwargs):
        self.es_host = es_host
        self._es = get_es(es_host, **kwargs)
        self._host_major_ver = int(self._es.info()['version']['number'].split('.')[0])
        if check_index:
            # if index is actually an alias, resolve the alias to
            # the real underlying index
            try:
                res = self._es.indices.get_alias(index=index)
                # this was an alias
                assert len(res) == 1, "Expecing '%s' to be an alias, but got nothing..." % index
                self._index = list(res.keys())[0]
            except NotFoundError:
                # this was a real index name
                self._index = index
        self._doc_type = None
        if doc_type:
            self._doc_type = doc_type
        else:
            # assuming index exists, get mapping to discover doc_type
            try:
                m = self.get_mapping()
                assert len(m) == 1, "Expected only one doc type, got: %s" % m.keys()
                self._doc_type = list(m).pop()
            except Exception as e:       # pylint: disable=broad-except
                if check_index:
                    logging.info("Failed to guess doc_type: %s", e)
        self.number_of_shards = number_of_shards            # set number_of_shards when create_index
        self.number_of_replicas = int(number_of_replicas)   # set number_of_replicas when create_index
        self.step = step or 500   # the bulk size when doing bulk operation.
        self.step_size = (step_size or 10) * 1048576  # MB -> bytes
        self.s = None      # number of records to skip, useful to continue indexing after an error.