mongodb-elasticsearch-river

Tool to index MongoDB documents using Elasticsearch

3 years after

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

Related Repositories

retire

retire

A rich Ruby API and DSL for the Elasticsearch search engine ...

elasticsearch-river-mongodb

elasticsearch-river-mongodb

MongoDB River Plugin for ElasticSearch ...

nunux-keeper

nunux-keeper

A open source content curation system. ...

atbat-mongodb

atbat-mongodb

A Perl project that pulls data from MLB's AtBat servers and shoves them into a l ...

elasticsearch-river-arangodb

elasticsearch-river-arangodb

ArangoDB River Plugin for ElasticSearch ...