Create and configure index

            If `wait_for_ready` is True, this function will block until
            status for `self.index_name` will be `yellow`

def setup_db(self, wait_for_ready=True):
        ''' Create and configure index

            If `wait_for_ready` is True, this function will block until
            status for `self.index_name` will be `yellow`
        '''

        if self.es.indices.exists(self.index_name):
            try:
                self.update_mappings()
            except MappingsException as ex:
                log.error(ex)
                log.warn('An old or wrong properties mapping has been found for index: "{0}",\
                          this could led to some errors. It is recomanded to run "libreant-db upgrade"'.format(self.index_name))
        else:
            log.debug("Index is missing: '{0}'".format(self.index_name))
            self.create_index()

        if wait_for_ready:
            log.debug('waiting for index "{}" to be ready'.format(self.index_name))
            self.es.cluster.health(index=self.index_name, level='index', wait_for_status='yellow')
            log.debug('index "{}" is now ready'.format(self.index_name))