elasticsearch-scrolltoend
Elasticsearch-js client extension for processing scroll results.
This module provides scrollToEnd
function which allows for processing each batch while scrolling search results.
Setup
Install the package.
npm install --save elasticsearch-scrolltoend
Then extend the Elasticsearch API by including this plugin.
'use strict'; const hosts = '127.0.0.1';const apiVersion = '2.x';const elasticsearch = ;const esScrollToEnd = ; const client = hosts apiVersion plugins: esScrollToEndplugin ;
Example
Define a function for processing batches.
let { console; return Promise;};
Start scrolling.
let index = `products`;let scroll = '60s';let scrollToEnd = client;return client;