
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
elasticsearch-writable-stream
Advanced tools
A writable stream for doing operations in Elasticsearch
A writable stream for doing operations in Elasticsearch with support for bulk actions. Supports virtually all indexing operations including index, update, update_by_query, and delete.
This module used to be known as elasticsearch-bulk-index-stream, but was renamed because the package has added support for non-bulk actions.
The records written to the stream has to have the following format:
{
index: 'name-of-index',
type: 'recordType',
id: 'recordId',
parent: 'parentRecordType', // optional
action: 'update', // optional (default: 'index')
body: {
name: 'Foo Bar'
}
}
The highWaterMark
option set on the stream defines how many items
will be buffered before doing a bulk operation. The stream will also
write all buffered items if its is closed, before emitting the
finish
event.
The update_by_query
action bypasses the buffer and gets executed at
once since its not supported by the bulk API.
Its also possible to send in the option flushTimeout
to indicate
that the items currently in the buffer should be flushed after the
given amount of milliseconds if the highWaterMark
haven't been
reached.
A bunyan,
winston or similar logger
instance that have methods like debug
, error
and info
may be
sent in as options.logger
to the constructor.
var ElasticsearchWritableStream = require('elasticsearch-writable-stream');
var stream = new ElasticsearchWritableStream(elasticsearchClient, {
highWaterMark: 256,
flushTimeout: 500
});
someInputStream
.pipe(stream)
.on('error', function(error) {
// Handle error
})
.on('finish', function() {
// Clean up Elasticsearch client?
})
See api.md.
Elasticsearch readable and writable streams. The main difference
between the bulk writer in elasticsearch-streams
and this library is
that this library requires the index
and type
of the data being
written to exist in the record instead of being set in a callback when
the records written.
elasticsearch-streams
also implements its own event named close
to
indicate that all the data has been written to Elasticsearch. This
will break modules like pump
that depend on the finish
event.
MIT
[2.0.1] - 2017-08-22
FAQs
A writable stream for doing operations in Elasticsearch
The npm package elasticsearch-writable-stream receives a total of 78 weekly downloads. As such, elasticsearch-writable-stream popularity was classified as not popular.
We found that elasticsearch-writable-stream demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
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.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.