sends the mapping to elasticsearch

        args:
            es_map: dictionary of the index mapping

        kwargs:
            reset_idx: WARNING! If True the current referenced es index
                    will be deleted destroying all data in that index in
                    elasticsearch. if False an incremented index will be
                    created and data-migration will start from the old to
                    the new index

def send_es_mapping(self, es_map, **kwargs):
        """
        sends the mapping to elasticsearch

        args:
            es_map: dictionary of the index mapping

        kwargs:
            reset_idx: WARNING! If True the current referenced es index
                    will be deleted destroying all data in that index in
                    elasticsearch. if False an incremented index will be
                    created and data-migration will start from the old to
                    the new index
        """
        log.setLevel(kwargs.get('log_level', self.log_level))

        def next_es_index_version(curr_alias):
            """ returns the next number for a new index

                args:
                    alias_def: the dictionary returned by es for get alias
            """
            try:
                alias_def = self.es.indices.get_alias(alias)
            except es_except.NotFoundError:
                alias_def = {alias + "_v0":{}}
            old_idx = list(alias_def)[0]
            parts = old_idx.split("_v")
            try:
                parts[1] = str(int(parts[1]) + 1)
            except IndexError:
                parts = [old_idx,'1']
            return {'old': old_idx, 'new': "_v".join(parts)}

        reset_idx= kwargs.get('reset_idx', False)
        alias = es_map.pop('index')
        idx_names = next_es_index_version(alias)

        # Delete if the index series if reset_idx was passed
        if reset_idx:
            log.warning("DELETING Elasticsearch INDEX => %s ******", alias)
            self.es.indices.delete(index=alias + "_v*", ignore=[400, 404])
            idx_names['new'] = alias + "_v1"

        # Create the new index and apply the mapping
        self.es.indices.create(index=idx_names['new'],
                               body=es_map['body'],
                               update_all_types=True)
        # if the index was not deleted transfer documents from old to the
        # new index
        if not reset_idx and self.es.indices.exists(idx_names['old']):
            url = os.path.join(self.es_url,'_reindex').replace('\\','/')
            data = {"source":{"index": idx_names['old']},
                    "dest":{"index": idx_names['new']}}
            # Python elasticsearch recommends using a direct call to the
            # es 5+ _reindex URL vice using their helper.
            result = requests.post(url,
                    headers={'Content-Type':'application/json'},
                    data = json.dumps(data))
            self.es.indices.delete_alias(index=idx_names['old'],
                                         name=alias,
                                         ignore=[403])
            self.es.indices.delete(index=idx_names['old'], ignore=[400, 404])
        # add the alias to the new index
        self.es.indices.put_alias(index=idx_names['new'], name=alias)