3.1.0 • Published 9 years ago
mongodb-elasticsearch-river v3.1.0
mongodb-elasticsearch-river
Tool to index MongoDB documents using Elasticsearch
require("mongodb-elasticsearch-river")
Methods
next(opts) - Build function to handle "next" event
@param {object} opts - Describes configuration
@param {object} opts.client - Elasticsearch client
@param {object} opts.emitter - Instance of EventEmitter
@param {index} opts.index - Index
@param {boolean} [opts.parse] - Parse next value, if function should receive stringified document instead of MongoDB oplog document
@returns {next} - Function to handle "next" event
init(opts, cb) - Initially import MongoDB documents, by default using index.namespace.collection
@param {object} opts - Describes configuration
@param {object} opts.client - Elasticsearch client
@param {function} opts.Timestamp - MongoDB Timestamp constructor - mongodb.Timestamp || bson.Timestamp
@param {index} opts.index - Index
@param {object} [opts.query = {}] - MongoDB query, if use collection to import
@param {object} [opts.oplog] - MongoDB oplog.rs collection, use it to import
@param {number} [opts.time] - Number of milliseconds, if use oplog.rs to import
@param {callback} [cb] - Callback
@returns {object} promise - Instance of Promise, if callback not defined
Type Definitions
namespace - Describes MongoDB namespace - 'db.collection'
@typedef {string} namespace
index - Describes configuration to build index
@typedef {object} index
@property {object} index.namespace - MongoDB namespace - 'db.collection'
@property {string} [index.namespace.index] - Elasticsearch index
@property {string} [index.namespace.type] - Elasticsearch type
@property {string[] | string} [index.namespace.fields] - MongoDB documents fields to index
@property {object} [index.namespace.collection] - MongoDB collection to initially import MongoDB documents or to update index using collection
@property {serialize} [index.namespace.serialize] - Function to serialize MongoDB document
@property {boolean} [index.namespace.script] - Update index using Elasticsearch scripting
serialize - Function to serialize MongoDB document
@typedef {function} serialize
@param {object} obj - MongoDB document
@returns {object} - MongoDB document
next - Function to handle "next" event, does index MongoDB document, fires "error" event on error, fires "success" event on index success
@typedef {function} next
@param {object | string} item - MongoDB oplog document || stringified document
callback
@callback callback
@param {object} err - Instance of Error
Examples
- run river, update index using index.namespace.collection
- run river, update index using Elasticsearch scripting
- initially import MongoDB documents using index.namespace.collection
- initially import MongoDB documents using index.namespace.collection with specified MongoDB query
- initially import MongoDB documents not imported yet using MongoDB oplog.rs collection
- initially import MongoDB documents which have been updated for specified time using MongoDB oplog.rs collections
3.1.0
9 years ago
3.0.7
9 years ago
3.0.6
9 years ago
3.0.5
9 years ago
3.0.4
9 years ago
3.0.3
9 years ago
3.0.2
9 years ago
3.0.1
9 years ago
3.0.0
9 years ago
2.1.6
9 years ago
2.1.5
9 years ago
2.1.4
9 years ago
2.1.3
10 years ago
2.1.2
10 years ago
2.1.1
10 years ago
2.1.0
10 years ago
2.0.2
10 years ago
2.0.1
10 years ago
2.0.0
10 years ago
1.1.3
10 years ago
1.1.2
10 years ago
1.1.1
10 years ago