def process(self, event):
        data = event.to_json()
        index = event.format(self.index)
        itype = event.format(self.type)
        if not index:
            raise ValueError("index is empty")
        if not itype:
            raise ValueError("type is empty")

        url = 'http://%s:%s/%s/%s/' % (self.host, self.port, index, itype)

        success = False
        delay = 1.0
        for retry in xrange(self.RETRIES):
            try:
                res = urllib2.urlopen(url, data=data)
                # 200 response indicates all is well
                success = True
                result = json.load(res)
                break
            except urllib2.HTTPError as ex:
                if ex.getcode() == 400:
                    # Bad Request - do not retry
                    self.logger.error("Bad request: %s, not retrying" % (ex,))
                    break
                else:
                    delay *= 2.0
                    self.logger.warn('Unable to index: %s, retrying in %ds' % (ex, delay))
                    gevent.sleep(delay)
            except urllib2.URLError as ex:
                delay *= 2.0
                self.logger.warn((ex, delay) % 'Unable to index: %s, retrying in %ds')
                gevent.sleep(delay)

        if success:
            self.logger.debug('Indexed to elasticsearch: index:%s type:%s id:%s' % (index, itype, result['_id']))
dataset/ETHPy150Open artirix/logcabin/logcabin/outputs/elasticsearch.py/Elasticsearch.process/swapped operands of `%`