es

elasticsearch-scrolltoend

Elasticsearch-js client extension for processing scroll results.

Showing:

Popularity

Downloads/wk

21

GitHub Stars

1

Maintenance

Last Commit

4yrs ago

Contributors

3

Package

Dependencies

0

Size (min+gzip)

0.5KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

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 = require('elasticsearch');
const esScrollToEnd = require('elasticsearch-scrolltoend');

const client = new elasticsearch.Client({
  hosts, apiVersion,
  plugins: [ esScrollToEnd.plugin ]
});

Example

Define a function for processing batches.

let batchHandler = function(res) {
  console.log(res);
  return Promise.resolve();
};

Start scrolling.

let index = `products`;
let scroll = '60s';
let scrollToEnd = client.scrollToEnd(scroll, batchHandler);
return client.search({index, scroll, search_type: 'scan'}).then(scrollToEnd);

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100