New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

es-bulk-update-builder

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

es-bulk-update-builder

Bulk update request body builder for Elasticsearch

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-25%
Maintainers
1
Weekly downloads
 
Created
Source

es-bulk-update-builder

Bulk update request body builder for Elasticsearch

npm version Codeship Status for stevejay/es-bulk-update-builder Coverage Status license

NPM

Install

$ npm install --save es-bulk-update-builder

Usage

Usage is basically as follows:

const BulkUpdateBuilder = require('es-bulk-update-builder');

const body = new BulkUpdateBuilder()
    .index({ name: 'my-doc' }, 'some-index', 'some-type', 'some-id', 3)
    .update({ name: 'other-doc' }, 'other-index', 'other-type', 'other-id', 4)
    .delete('another-index', 'another-type', 'another-id', 5)
    .build();

// The body variable can now be passed to the JavaScript elasticsearch client, e.g.:
// client.bulk({ body: body });

The index method is for adding a document, the update method is for updating a document, and the delete method is for deleting a document.

For each action you can specify a version number, for example 3 in the following example:

const body = new BulkUpdateBuilder()
    .index({ name: 'my-doc' }, 'some-index', 'some-type', 'some-id', 3);

If you do specify a version, the version type is set to external. You can override that by specifying the desired version type, which in the following example is external_gte:

const body = new BulkUpdateBuilder()
    .index({ name: 'my-doc' }, 'some-index', 'some-type', 'some-id', 3, 'external_gte');

To specify no versioning information, simply omit it:

const body = new BulkUpdateBuilder()
    .index({ name: 'my-doc' }, 'some-index', 'some-type', 'some-id');

License

MIT

Keywords

FAQs

Package last updated on 11 Jun 2018

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc