SDK
SDK PHP v3.x
1

You are currently looking at the documentation of a previous version of Kuzzle. We strongly recommend that you use the latest version. You can also use the version selector in the top menu.

scroll #

Returns a SearchResult object containing the next page of the scroll session, and the scrollId to be used in the next scroll action. A scroll session is always initiated by a search action and including the scroll argument; more information below.

There is a small delay between the time a document is created and its availability in our search layer (usually a couple of seconds). That means that a document that was just created might not be returned immediately by this function.

To get more information about scroll sessions, please refer to the API reference documentation.


scroll(scrollId, [options], callback) #

ArgumentsTypeDescription
scrollIdstringThe "scrollId" provided with the last scroll response or from the initial search request if it is the first scroll call
optionsJSON objectOptional parameters
callbackfunctionCallback handling the response

Options #

OptionTypeDescriptionDefault
queuablebooleanMake this request queuable or nottrue
scrollstringRe-initializes the scroll session timeout to its value. If not defined, the scroll timeout is defaulted to a Kuzzle configurationundefined

Callback Response #

Returns an instantiated SearchResult object.


Usage #

<?php
use \Kuzzle\Kuzzle;
use \Kuzzle\Document;
use \Kuzzle\Util\SearchResult;
$kuzzle = new Kuzzle('localhost');
$dataCollection = $kuzzle->collection('collection', 'index');
try {
  $searchResult = $dataCollection->scroll($scrollId, ['scroll' => '1m']);
  // $searchResult instanceof SearchResult
  $searchResult->getTotal();
  foreach($searchResult->getDocuments() as $document) {
    // $document instanceof Document
  }
  // return an array representing the aggregations response
  $searchResult->getAggregations();
}
catch (ErrorException $e) {
}