The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

    Data::AnyXfer::Elastic::ScrollHelper - ScrollHelper for ES

DESCRIPTION

A wrapper around Search::Elasticsearch::Scroll instance for ES search, for scrolling through batches of ES results.

SYNOPSIS

    use Data::AnyXfer::Elastic::ScrollHelper;

    my $scroll_helper = Data::AnyXfer::Elastic::ScrollHelper->new(
        extract_results => $extract_results,
        scroll_helper   => $self->es->scroll_helper,
    );

    while (my $result = $scroll_helper->next) {
        ...
    }

ATTRIBUTES

scroll_helper

The instance of Search::Elasticsearch::Scroll from the ES search. Required.

extract_results

Should the results be extracted? Changes the results returned by "next" in . and "drain_buffer" in ..

METHODS

next

    while (my $result = $scroll_helper->next) {
        ...
    }

Fetch the next result from ES buffer - fetching more results if required. Returns empty list when there are no more results.

If "extract_results" in . is true then the results are extracted from _source.

drain_buffer

    while ($scroll_helper->refill_buffer) {

        my @results = $scroll_helper->drain_buffer;

        ...
    }

Empties the buffer and returts a list of results from it.

If "extract_results" in . is true then the results are extracted from _source.

COPYRIGHT

This software is copyright (c) 2019, Anthony Lucas.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.