2.0.0 • Published 6 years ago

dynamo-to-elasticsearch v2.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

Dynamo-to-ElasticSearch

A NPM module that will dump all DynamoDB data to AWS ElasticSearch indices.

What this does

It takes entire table from DynamoDB and injects it to AWS Elasticsearch service. It may serve as a blueprint in AWS Lambda, however it is not based on streams, but on DynamoDB scan operation.

This module is an extended version of dynamodb-to-elasticsearch. The difference is that here you can set your own primaryKey as well as index type. It is a separate repository as it breaks backward compatibility.


Installation

$ npm install dynamo-to-elasticsearch

Guide to configure AWS to use this blueprint

Documentation

module.exec (table, region, es_endpoint, es_data = { id: 'sortKey', type: 'datatype', indiceName: ''})

ParameterTypeDescription
tablestringTable name of dynamoDB whose data you want to dump in elastic-search.
regionstringdynamodb table region
es_endpointstringelastic-search endpoint
es_dataobject
es_data.idstringThe name of primaryKey field for DynamoDB table. It should be unique identifier for documents. By default it is set to sortKey.
es_data.typestringName of class of objects, which document represents. By default it is set to datatype.
es_data.indiceNamestringIndex name of elastic-search on which you can perform query.

Example

const d2es = require('dynamodb-to-elasticsearch');

const table = 'table',
	region = 'region',
	es_endpoint = 'es_endpoint_value',
	es_data = { id: 'sortKey', type: 'data', indiceName: 'candidates' }};

exports.handler = function(event, context, callback) {
	d2es.exec(table, region, es_endpoint, es_data, (err, success) => {
	    if (err) {
			callback(err, null);
		} else {
			callback(null, success);
		}
	});
}

License

MIT