elasticsearch-doc-stream
v1.0.0
Published
read stream of elasticsearch documents
Downloads
10
Readme
elasticsearch-doc-stream
A read stream of elasticsearch documents. Handy for reporting.
var docStream = require('elasticsearch-doc-stream');
var users = [];
var d = docStream({
url: 'http://localhost:9200/test',
search: {
query: {
match: {
title: "elasticsearch"
}
}
}
});
d.on('data', function (doc) {
var user = doc._source.user;
if (users.indexOf(user) === -1) {
users.push(user);
}
});
d.on('error', function (err) {
console.error(err);
});
d.on('end', function () {
console.log(users);
});