You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

elasticsearch-scrolltoend

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

elasticsearch-scrolltoend

Elasticsearch-js client extension for processing scroll results.

0.3.0
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

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);

Keywords

elasticsearch

FAQs

Package last updated on 11 Jul 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts