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" eventinit(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 definedType Definitions
namespace - Describes MongoDB namespace - 'db.collection'
@typedef {string} namespaceindex - 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 scriptingserialize - Function to serialize MongoDB document
@typedef {function} serialize
@param {object} obj - MongoDB document
@returns {object} - MongoDB documentnext - 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 documentcallback
@callback callback
@param {object} err - Instance of ErrorExamples
- 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
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago