def es_read(self, log_id, offset):
        """
        Returns the logs matching log_id in Elasticsearch and next offset.
        Returns '' if no log is found or there was an error.
        :param log_id: the log_id of the log to read.
        :type log_id: str
        :param offset: the offset start to read log from.
        :type offset: str
        """

        # Offset is the unique key for sorting logs given log_id.
        s = Search(using=self.client) \
            .query('match_phrase', log_id=log_id) \
            .sort('offset')

        s = s.filter('range', offset={'gt': offset})

        logs = []
        if s.count() != 0:
            try:

                logs = s[self.MAX_LINE_PER_PAGE * self.PAGE:self.MAX_LINE_PER_PAGE] \
                    .execute()
            except Exception as e:
                self.log.exception('Could not read log with log_id: %s, error: %s', log_id, str(e))

        return logs
def es_read(self, log_id, offset):
        """
        Returns the logs matching log_id in Elasticsearch and next offset.
        Returns '' if no log is found or there was an error.
        :param log_id: the log_id of the log to read.
        :type log_id: str
        :param offset: the offset start to read log from.
        :type offset: str
        """

        # Offset is the unique key for sorting logs given log_id.
        s = Search(using=self.client) \
            .query('match_phrase', log_id=log_id) \
            .sort('offset')

        s = s.filter('range', offset={'gt': offset})

        logs = []
        if s.count() != 0:
            try:

                logs = s[self.MAX_LINE_PER_PAGE * self.PAGE:self.MAX_LINE_PER_PAGE] \
                    .execute()
            except Exception as e:
                self.log.exception('Could not read log with log_id: %s, error: %s', log_id, str(e))

        return logs
def es_read ( self , log_id , offset ) : # Offset is the unique key for sorting logs given log_id. s = Search ( using = self . client ) . query ( 'match_phrase' , log_id = log_id ) . sort ( 'offset' ) s = s . filter ( 'range' , offset = { 'gt' : offset } ) logs = [ ] if s . count ( ) != 0 : try : logs = s [ self . MAX_LINE_PER_PAGE * self . PAGE : self . MAX_LINE_PER_PAGE ] . execute ( ) except Exception as e : self . log . exception ( 'Could not read log with log_id: %s, error: %s' , log_id , str ( e ) ) return logs
Returns the logs matching log_id in Elasticsearch and next offset.
        Returns '' if no log is found or there was an error.
        :param log_id: the log_id of the log to read.
        :type log_id: str
        :param offset: the offset start to read log from.
        :type offset: str
Returns the logs matching log_id in Elasticsearch and next offset . Returns if no log is found or there was an error . : param log_id : the log_id of the log to read . : type log_id : str : param offset : the offset start to read log from . : type offset : str