.Collect every title in the index that contains the word "test"
[source,js]
---------
var allTitles = [];

// first we do a search, and specify a scroll timeout
client.search({
  index: 'myindex',
  // Set to 30 seconds because we are calling right back
  scroll: '30s',
  search_type: 'scan',
  fields: ['title'],
  q: 'title:test'
}, function getMoreUntilDone(error, response) {
  // collect the title from each response
  response.hits.hits.forEach(function (hit) {
    allTitles.push(hit.fields.title);
  });

  if (response.hits.total !== allTitles.length) {
    // now we can call scroll over and over
    client.scroll({
      scrollId: response._scroll_id,
      scroll: '30s'
    }, getMoreUntilDone);
  } else {
    console.log('every "test" title', allTitles);
  }
});
---------
