elasticsearch-search-stream
v1.0.2
Published
elasticsearch search results returned as readable stream
Downloads
4
Readme
Stream search results from elastic search
Requirements
Any elasticsearch client supporting search
and scroll
.
Verified against [email protected]
+
Options
client
search
Usage
var SearchStream = require('elasticsearch-search-stream')
var elasticsearch = require('elasticsearch')
var stringify = require('csv-stringify')
var fs = require('fs')
var client = new elasticsearch.Client({
host: 'localhost:9202',
log: 'trace'
})
// a scroll of '30s' will be applied by default
var search = {
index: '2731107',
body: {
filter: {
prefix: {
firstName: 'a'
}
}
}
}
var searchStream = new SearchStream({ client: client, search: search })
searchStream
.pipe(stringify())
.pipe(fs.createWriteStream("my_file.txt"))
- Inspired by node-pg-query-stream