appbase-js
Advanced tools
Comparing version 0.7.1 to 0.7.2
{ | ||
"name": "appbase-js", | ||
"version": "0.7.1", | ||
"version": "0.7.2", | ||
"homepage": "https://github.com/appbaseio/appbase-js", | ||
@@ -5,0 +5,0 @@ "authors": [ |
@@ -68,4 +68,4 @@ 'use strict'; | ||
client.search = this.search.bind(this); | ||
client.streamDocument = this.streamDocument.bind(this); | ||
client.streamSearch = this.streamSearch.bind(this); | ||
client.readStream = this.readStream.bind(this); | ||
client.searchStream = this.searchStream.bind(this); | ||
client.getTypes = this.getTypes.bind(this); | ||
@@ -104,7 +104,7 @@ | ||
appbaseClient.prototype.streamDocument = function streamDocument(args) { | ||
appbaseClient.prototype.readStream = function readStream(args) { | ||
return new streamDocumentService(this, args); | ||
}; | ||
appbaseClient.prototype.streamSearch = function streamSearch(args) { | ||
appbaseClient.prototype.searchStream = function searchStream(args) { | ||
return new streamSearchService(this, args); | ||
@@ -111,0 +111,0 @@ }; |
{ | ||
"name": "appbase-js", | ||
"version": "0.7.1", | ||
"version": "0.7.2", | ||
"description": "Appbase.io streaming client lib for Javascript", | ||
@@ -5,0 +5,0 @@ "main": "dist/appbase.js", |
@@ -39,6 +39,8 @@ # appbase-js | ||
#### Step 2: Stream the Document Updates | ||
#### Step 2: Read the data stream from a particular DB location | ||
Returns continous updates on a JSON document from a particular ``type``. | ||
```js | ||
appbase.streamDocument({ | ||
appbase.readStream({ | ||
type: 'product', | ||
@@ -69,10 +71,10 @@ id: '1' | ||
streamDocument() returns a ``stream.Readable`` object, which can be conveniently listened via the 'on("data")' event listener. Check out the [stream_document_test.js](https://github.com/appbaseio/appbase-js/blob/master/test/stream_document_test.js) where we make an update to the document and see any further updates to it via the 'data' event. | ||
readStream() returns a ``stream.Readable`` object, which can be conveniently listened via the 'on("data")' event listener. Check out the [stream_document_test.js](https://github.com/appbaseio/appbase-js/blob/master/test/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: Streaming Queries | ||
#### Step 3: Apply queries on data streams | ||
While streaming documents is straightforward, streaming queries touch the entire breadth of [ElasticSearch Query DSL](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl.html) - boolean, regex, geo, fuzzy to name a few. Let's stream the results of a simple **``match_all``** query on the ``product`` type: | ||
Get continuous results by searching across the database streams. A query can be written using the [ElasticSearch Query DSL](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl.html) - which supports composing boolean, regex, geo, fuzzy, range queries. Let's stream the results of a simple **``match_all``** query on the ``product`` type: | ||
```js | ||
appbase.streamSearch({ | ||
appbase.searchStream({ | ||
type: 'product', | ||
@@ -103,3 +105,3 @@ body: { | ||
streamSearch() also returns a ``stream.Readable`` object, which can be conveniently listened via the 'on("data")' event listener. Check out the [stream_search_test.js](https://github.com/appbaseio/appbase-js/blob/master/test/stream_search_test.js) where we make an update that matches the query and see the results in the event stream. | ||
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](https://github.com/appbaseio/appbase-js/blob/master/test/stream_search_test.js) where we make an update that matches the query and see the results in the event stream. | ||
@@ -125,5 +127,5 @@ | ||
**[reference.streamDocument(args)](https://github.com/appbaseio/appbase-js/blob/master/appbase.js#L99)** | ||
**[reference.readStream(args)](https://github.com/appbaseio/appbase-js/blob/master/appbase.js#L99)** | ||
Get all the document updates as a continuous event stream. Returns a [``stream.Readable``](https://nodejs.org/api/stream.html#stream_class_stream_readable) object. | ||
Get continuous updates on a JSON document with a ``type`` and ``id``. Returns a [``stream.Readable``](https://nodejs.org/api/stream.html#stream_class_stream_readable) object. | ||
@@ -134,5 +136,5 @@ > **args** - A set of key/value pairs that makes the document URL | ||
**[reference.streamSearch(args)](https://github.com/appbaseio/appbase-js/blob/master/appbase.js#L103)** | ||
**[reference.searchStream(args)](https://github.com/appbaseio/appbase-js/blob/master/appbase.js#L103)** | ||
Get all the query results as a continuous event stream. Returns a [``stream.Readable``](https://nodejs.org/api/stream.html#stream_class_stream_readable) object. | ||
Get continuous updates on search queries (fuzzy, boolean, geolocation, range, full-text). Returns a [``stream.Readable``](https://nodejs.org/api/stream.html#stream_class_stream_readable) object. | ||
@@ -139,0 +141,0 @@ > **args** - A set of key/value pairs that makes the document URL |
@@ -66,4 +66,4 @@ var URL = require('url') | ||
client.search = this.search.bind(this) | ||
client.streamDocument = this.streamDocument.bind(this) | ||
client.streamSearch = this.streamSearch.bind(this) | ||
client.readStream = this.readStream.bind(this) | ||
client.searchStream = this.searchStream.bind(this) | ||
client.getTypes = this.getTypes.bind(this) | ||
@@ -102,7 +102,7 @@ | ||
appbaseClient.prototype.streamDocument = function streamDocument(args) { | ||
appbaseClient.prototype.readStream = function readStream(args) { | ||
return new streamDocumentService(this, args) | ||
} | ||
appbaseClient.prototype.streamSearch = function streamSearch(args) { | ||
appbaseClient.prototype.searchStream = function searchStream(args) { | ||
return new streamSearchService(this, args) | ||
@@ -109,0 +109,0 @@ } |
@@ -18,3 +18,3 @@ var assert = require('assert') | ||
var first = true | ||
var responseStream = streamingClient.streamDocument({ | ||
var responseStream = streamingClient.readStream({ | ||
type: 'tweet', | ||
@@ -21,0 +21,0 @@ id: '2' |
@@ -15,3 +15,3 @@ var assert = require('assert') | ||
var first = true | ||
var responseStream = streamingClient.streamDocument({ | ||
var responseStream = streamingClient.readStream({ | ||
type: 'tweet', | ||
@@ -18,0 +18,0 @@ id: '1' |
@@ -19,3 +19,3 @@ var assert = require('assert') | ||
var first = true | ||
var responseStream = streamingClient.streamDocument({ | ||
var responseStream = streamingClient.readStream({ | ||
type: 'tweet', | ||
@@ -77,3 +77,3 @@ id: '1' | ||
var first = true | ||
var responseStream = streamingClient.streamDocument({ | ||
var responseStream = streamingClient.readStream({ | ||
type: 'tweet', | ||
@@ -134,3 +134,3 @@ id: '1', | ||
var first = true | ||
var responseStream = streamingClient.streamDocument({ | ||
var responseStream = streamingClient.readStream({ | ||
type: 'tweet', | ||
@@ -137,0 +137,0 @@ id: '1' |
@@ -19,3 +19,3 @@ var assert = require('assert') | ||
var first = true | ||
var responseStream = streamingClient.streamSearch({ | ||
var responseStream = streamingClient.searchStream({ | ||
type: 'tweet', | ||
@@ -22,0 +22,0 @@ body: { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
743463
17161
139