couch2elastic4sync v7.1.0
couch2elastic4sync
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 couch2elastic4sync -gUsage
Configuration file
rc is used to set to variables. For example, create a .couch2elastic4sync file with the following
database=http://localhost:5984/idx-edm-v5
elasticsearch=http://elastic-1.com:9200/idx-edm-v5/listingor pass the config file path explicity
couch2elastic4sync --config=path/to/configfileAlternatively, 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=listingLoad documents
To load all the documents into elasticsearch, run
couch2elastic4sync loadKeep documents in sync
To keep a sync process going, run
couch2elastic4syncLoad just one doc
couch2elastic4sync id 19404098where it is the id from couch
Cleanup deleted docs
Sometimes there are docs in elasticsearch, that dont match any docs in couch. This task cleans those up (removes them) from elasticsearch.
couch2elastic4sync cleanupFormat 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.jsWhere 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
6 years ago
6 years ago
8 years ago
8 years ago
8 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
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