Skip to content
This repository has been archived by the owner on Jan 19, 2024. It is now read-only.

feat: add indexAutomatically option to disable middleware hooks #50

Merged
merged 3 commits into from Oct 29, 2018
Merged

feat: add indexAutomatically option to disable middleware hooks #50

merged 3 commits into from Oct 29, 2018

Conversation

florianbepunkt
Copy link
Contributor

closes #49

indexAutomatically option is set to true by default. when set to false, middleware hooks are not fired which allows for more fine grained control over when a document should be indexed/removed

@coveralls
Copy link

coveralls commented Oct 27, 2018

Coverage Status

Coverage increased (+0.05%) to 91.949% when pulling ea3a5b6 on florianbepunkt:master into 09216b4 on jbdemonte:master.

@nodkz
Copy link
Collaborator

nodkz commented Oct 27, 2018

Please rename option to onlyOnDemandIndexing and add info about it to README.

Thanks.

README.md Outdated
- `bulk.batch` - [batchSize](https://docs.mongodb.com/manual/reference/method/cursor.batchSize/) to use on synchronise options. Defaults to 50.
- `bulk.size` - bulk element count to wait before calling `client.bulk` function. Defaults to 1000.
- `bulk.delay` - idle time to wait before calling the `client.bulk` function. Defaults to 1000.
- `onlyOnDemandIndexing` - whether or not to automatically index on CRUD operations. If set to false mexp middleware hooks for save, delete, update do not fire. Defaults to true.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- whether or not to automatically index on CRUD operations. If set to false mexp middleware hooks for save, delete, update do not fire. Defaults to true.
+ whether or not to automatically index on CRUD operations. If set to true mexp middleware hooks for save, delete, update do not fire. Defaults to false.

onlyOnDemandIndexing: true - means that indexing should be called manually. Current implementation breaks my mind ;)) Please fix it.

lib/index.js Show resolved Hide resolved
lib/index.js Show resolved Hide resolved
@nodkz
Copy link
Collaborator

nodkz commented Oct 27, 2018

FYI You also may use Filtered Indexing https://github.com/jbdemonte/mongoose-elasticsearch-xp#filtered-indexing. When some field in model has proper values, then doc be send or removed from ES index.

@nodkz nodkz merged commit 3df0cb3 into jbdemonte:master Oct 29, 2018
@nodkz
Copy link
Collaborator

nodkz commented Oct 29, 2018

Make proper changes myself directly to master

@nodkz
Copy link
Collaborator

nodkz commented Oct 29, 2018

@florianbepunkt thanks for PR

nodkz added a commit that referenced this pull request Oct 29, 2018
@nodkz
Copy link
Collaborator

nodkz commented Oct 29, 2018

@florianbepunkt Version 5.6.0 was just published to npm.
Please try it with your app.

@florianbepunkt
Copy link
Contributor Author

florianbepunkt commented Oct 30, 2018 via email

@florianbepunkt
Copy link
Contributor Author

@nodkz Working great, thank you

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Disabling automatic indexing of documents
3 participants