mongodb - Bonsai automatic indexing -


i use mongodb storage express, heroku-hosted app.

i provide search capabilities mongodb collections, using elasticsearch via bonsai heroku add-on.

however, according bonsai faq, elasticsearch river plugins not supported.

how can automatically re-index mongodb collections (when mongodb document created/updated/deleted) on bonsai, using custom mapping, if cannot use elasticsearch-river-mongodb?

here answer bonsai support:

- set script curl command index mongodb collections, use cron run script @ regular intervals. - use elasticsearch client index collections in cases. 

so made reindex script inspired elaster, can:

  • either called @ regular intervals node-cron;

  • or called on demand, following event detection; trigger events use mongo-oplog, so:

    oplog.on('insert', function (doc) {   reindex(); }); 

Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -