Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bimedia-fr/elastic-bulk-writable
expose elasticsearch BulkOp as a writable stream
https://github.com/bimedia-fr/elastic-bulk-writable
Last synced: 23 days ago
JSON representation
expose elasticsearch BulkOp as a writable stream
- Host: GitHub
- URL: https://github.com/bimedia-fr/elastic-bulk-writable
- Owner: bimedia-fr
- License: apache-2.0
- Created: 2016-07-09T20:52:44.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-07-18T08:58:56.000Z (over 8 years ago)
- Last Synced: 2024-11-07T11:33:50.485Z (2 months ago)
- Language: JavaScript
- Size: 7.81 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# elastic-bulk-writable
expose elasticsearch Bulk as a writable stream## Install
> npm install --save elastic-bulk-writable
## Usage
Simple use case :
```js
var BulkWritable = require('elastic-bulk-writable');
var client; // get elastic client
var opts = {
client: client,
indexName: 'myindex',
indexType: 'mytype'
};
var writable = new BulkWritable(opts, function write(chunk, next) {
this.bulk.push({"index": {}});
this.bulk.push(chunk);
next();
});readable.pipe(writable);
```Index shortcut:
```js
var BulkWritable = require('elastic-bulk-writable');
var client; // get elastic client
var opts = {
client: client,
indexName: 'myindex',
indexType: 'mytype'
};
var writable = new BulkWritable(opts);
readable.pipe(writable);
```