Console Output

getStream() returns a stream.Readable object, which can be conveniently listened via the on("data") event listener. Check out the stream_document_test.js where we make an update to the document and see any further updates to it via the "data" event.

Step 3: Apply queries on data streams

Get continuous results by searching across the database streams. A query can be written using the ElasticSearch Query DSL - which supports composing boolean, regex, geo, fuzzy, range queries. Let's stream the results of a simple match_all query on the product type:

Console Output

searchStream() also returns a stream.Readable object, which can be conveniently listened via the on("data") event listener. Check out the stream_search_test.js where we make an update that matches the query and see the results in the event stream.

API Reference

Global

Returns a reference object on which streaming requests can be performed.

args - A set of key/value pairs that configures the ElasticSearch Index
url: "https://scalr.api.appbase.io"
app: App name (equivalent to an ElasticSearch Index)
credentials: A username:password combination used for Basic Auth.

Optionally (and like in the quick example above), url can contain the credentials field in the format: https://<credentials>@scalr.appbase.io.