Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gsf/elasticsearch-doc-stream
read stream of elasticsearch documents
https://github.com/gsf/elasticsearch-doc-stream
Last synced: 7 days ago
JSON representation
read stream of elasticsearch documents
- Host: GitHub
- URL: https://github.com/gsf/elasticsearch-doc-stream
- Owner: gsf
- Created: 2015-03-24T07:03:50.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-04-04T02:23:42.000Z (almost 10 years ago)
- Last Synced: 2024-04-15T12:13:33.133Z (9 months ago)
- Language: JavaScript
- Size: 168 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# elasticsearch-doc-stream
A read stream of elasticsearch documents. Handy for reporting.
```js
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);
});
```