GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  ELASTICSEARCH::SCROLLEDSEARCH (3)

.ds Aq ’

NAME

ElasticSearch::ScrolledSearch - Description

CONTENTS

SYNOPSIS



    $scroller = $es->scrolled_search($search_params);
  OR
    $scroller = ElasticSearch::ScrolledSearch($es,$search_params);

    while (my $result = $scroller->next) {
        # do something
    }

    $total  = $scroller->total;
    $bool   = $scroller->eof
    $score  = $scroller->max_score;
    $facets = $scroller->facets;



DESCRIPTION

ElasticSearch::ScrolledSearch is a convenience iterator for scrolled searches. It accepts the standard search parameters that would be passed to search() in ElasticSearch. The scroll parameter defaults to 1m.



    $scroller = $es->scrolled_search(
                    query  => {match_all=>{}},
                    scroll => 5m               # keep the scroll request
                                                 # live for 5 minutes
                );



METHODS

CWnew()



    $scroller = $es->scrolled_search($search_params);
  OR
    $scroller = ElasticSearch::ScrolledSearch($es,$search_params);



next()



    @results = $scroller->next()
    @results = $scroller->next($no_of_results);



Returns the next result, or the next $no_of_results or an empty list when no more results are available.

An error is thrown if the scroll has already expired.

If as_json => 1 is specified, then next() will always return a JSON array:



   $scroller->next()
   # [{...}]

   $scroller->next(2)
   # [{...},{...}]

   # if no results left: []



drain_buffer()



    @docs = $scroller->drain_buffer;



Returns and removes all docs that are currently stored in the buffer.

refill_buffer()



    $buffer_size = $scroller->refill_buffer



Pulls the next set of results from ElasticSearch (if any) and returns the total number of docs stored in the internal buffer.

total()



    $total = $scroller->total



The total number of hits

max_score()



    $score = $scroller->max_score



The max_score returned from the first search request (if available).

eof()



    $bool = $scroller->eof



Returns true if no more results are available. Note: if no results match the search, then eof() could be false but the first call to next() will return zero results.

facets()



    $facets = $scroller->facets



The facets returned from the first search request (if any).

If as_json => 1 is specified, then facets() will always return a JSON object.

SEE ALSO

scrolled_search() in ElasticSearch, search() in ElasticSearch and scroll() in ElasticSearch

BUGS

None known

AUTHOR

Clinton Gormley, <clinton@traveljury.com>

COPYRIGHT AND LICENSE

Copyright (C) 2011 by Clinton Gormley

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.7 or, at your option, any later version of Perl 5 you may have available.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 ELASTICSEARCH::SCROLLEDSEARCH (3) 2013-09-24

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.