I hereby claim:
- I am markbirbeck on github.
- I am markbirbeck (https://keybase.io/markbirbeck) on keybase.
- I have a public key ASBaGjQr-TzHG1tU2ciXqbwppkrYU98qgj385aq7sRQ9Ago
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| const stream = require('stream') | |
| class ElasticSearchWritableStream extends stream.Writable { | |
| constructor(config, options) { | |
| super(options) | |
| this.config = config | |
| /** | |
| * Create the ElasticSearch client: | |
| */ |
| class ElasticSearchWritableStream extends stream.Writable { | |
| constructor(config, options) { | |
| super(options) | |
| this.config = config | |
| /** | |
| * Create the ElasticSearch client: | |
| */ | |
| this.client = new elasticsearch.Client({ |
| class ElasticSearchWritableStream extends stream.Writable { | |
| ... | |
| async _writev(chunks, next) { | |
| const body = chunks | |
| .map(chunk => chunk.chunk) | |
| .reduce((arr, obj) => { | |
| /** | |
| * Each entry to the bulk API comprises an instruction (like 'index' | |
| * or 'delete') and some data: |
| class ElasticSearchWritableStream extends stream.Writable { | |
| constructor(config) { | |
| ... | |
| } | |
| /** | |
| * When writing a single record, we use the index() method of | |
| * the ES API: | |
| */ |
| const stream = require('stream') | |
| const elasticsearch = require('elasticsearch') | |
| class ElasticSearchWritableStream extends stream.Writable { | |
| constructor(config) { | |
| super() | |
| this.config = config | |
| /** | |
| * Create the ElasticSearch client: |
| const stream = require('stream') | |
| class ElasticSearchWritableStream extends stream.Writable { | |
| } | |
| module.exports = ElasticSearchWritableStream |
# Update repos
#
sudo apt update
sudo apt install --only-upgrade -y \
gcc-5-base \
libstdc++6
# Tools
#| var heapdump = require('heapdump'); | |
| function generateHeapDumpAndStats(){ | |
| //1. Force garbage collection every time this function is called | |
| try { | |
| global.gc(); | |
| } catch (e) { | |
| console.log('You must run program with \'node --expose-gc index.js\''); | |
| process.exit(); | |
| } |
| # Courtesy of: | |
| # | |
| # http://stackoverflow.com/questions/31990757/network-timed-out-while-trying-to-connect-to-https-index-docker-io | |
| # | |
| docker-machine restart default | |
| eval $(docker-machine env default) |