lib/query.js
function bridge_fetch(size) {
        var bridge_time = new JuttleMoment(last_seen_timestamp);

        var time_filter = {term: {}};
        time_filter.term[timeField] = bridge_time.valueOf();

        var body = make_body(filter, null, null, direction, time_filter, size, timeField);
        body.from = bridge_offset;

        if (bridge_offset > deep_paging_limit) {
            return Promise.reject(new Error('Cannot fetch more than ' + deep_paging_limit + ' points with the same timestamp'));
        }

        return common.search(client, indices, type, body)
            .then(function(result) {
                var processed = points_and_eof_from_es_result(result, body);
                bridge_offset += body.size;
                if (processed.eof) {
                    // end of the bridge fetch, not necessarily end of the query
                    // (if it really is the end of the query then the non-brige-path
                    // will fetch one more empty batch and return eof)
                    should_execute_bridge_fetch = false;
                    query_start = bridge_time.add(JuttleMoment.duration(1, 'milliseconds'));
                    processed.eof = false;
                }

                return processed;
            });
    }
function bridge_fetch(size) {
        var bridge_time = new JuttleMoment(last_seen_timestamp);

        var time_filter = {term: {}};
        time_filter.term[timeField] = bridge_time.valueOf();

        var body = make_body(filter, null, null, direction, time_filter, size, timeField);
        body.from = bridge_offset;

        if (bridge_offset > deep_paging_limit) {
            return Promise.reject(new Error('Cannot fetch more than ' + deep_paging_limit + ' points with the same timestamp'));
        }

        return common.search(client, indices, type, body)
            .then(function(result) {
                var processed = points_and_eof_from_es_result(result, body);
                bridge_offset += body.size;
                if (processed.eof) {
                    // end of the bridge fetch, not necessarily end of the query
                    // (if it really is the end of the query then the non-brige-path
                    // will fetch one more empty batch and return eof)
                    should_execute_bridge_fetch = false;
                    query_start = bridge_time.add(JuttleMoment.duration(1, 'milliseconds'));
                    processed.eof = false;
                }

                return processed;
            });
    }
function bridge_fetch ( size ) { var bridge_time = new JuttleMoment ( last_seen_timestamp ) ; var time_filter = { term : { } } ; time_filter . term [ timeField ] = bridge_time . valueOf ( ) ; var body = make_body ( filter , null , null , direction , time_filter , size , timeField ) ; body . from = bridge_offset ; if ( bridge_offset > deep_paging_limit ) { return Promise . reject ( new Error ( 'Cannot fetch more than ' + deep_paging_limit + ' points with the same timestamp' ) ) ; } return common . search ( client , indices , type , body ) . then ( function ( result ) { var processed = points_and_eof_from_es_result ( result , body ) ; bridge_offset += body . size ; if ( processed . eof ) { // end of the bridge fetch, not necessarily end of the query // (if it really is the end of the query then the non-brige-path // will fetch one more empty batch and return eof) should_execute_bridge_fetch = false ; query_start = bridge_time . add ( JuttleMoment . duration ( 1 , 'milliseconds' ) ) ; processed . eof = false ; } return processed ; } ) ; }
if more than fetchSize events have the same timestamp, we do a "bridge fetch" which pages through all the points with that timestamp
if more than fetchSize events have the same timestamp we do a bridge fetch which pages through all the points with that timestamp