Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

couch2elastic

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

couch2elastic

Sync couchdb data to elasticsearch.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-90%
Maintainers
1
Weekly downloads
 
Created
Source

couch2elastic

Since Elasticsearch rivers are deprecated this is a simple node process that will follow a couchdb changes feed and updates elasticsearch.

You can also include an optional mapper.

npm install couch2elastic -g

Usage

Configuration file

rc is used to set to variables. For example, create a .couch2elastic file with the following

database=http://localhost:5984/idx-edm-v5
elasticsearch=http://elastic-1.com:9200/idx-edm-v5/listing

or pass the config file path explicity

couch2elastic --config=path/to/configfile

Alternatively, the config file can be in JSON

{
  "database": "http://localhost:5984/idx-edm-v5",
  "elasticsearch": "http://elastic-1.com:9200/idx-edm-v5/listing"
}

You can also destructure some of the urls to help configuration management

couch=http://localhost:5984
database=idx-edm-v5
elasticsearch=http://elastic-1.com:9200
indexName=idx-edm-v5
indexType=listing

Load documents

To load all the documents into elasticsearch, run

couch2elastic load

Keep documents in sync

To keep a sync process going, run

couch2elastic

Format and filter documents

A mapper function can be passed from the config to format documents before being put to ElasticSearch:

database=http://localhost:5984/idx-edm-v5
elasticsearch=http://elastic-1.com:9200/idx-edm-v5/listing
mapper=path/to/my-mapper.js

Where my-mapper.js could be something like

module.exports = function (doc) {
  // apply formatting here
  return doc
}

If the function returns empty, the document is filtered-out

License

MIT

FAQs

Package last updated on 19 Jun 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc