-
Notifications
You must be signed in to change notification settings - Fork 215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Delete index when corresponding collection is dropped #79
Comments
I had similar concerns. But apparently I can setup up rivers from different mongo collections to the same index. |
The exact problem we are having is when we drop a collection, delete the index and create the same collection and the same index. The river reads the opslog collection from MongoDB and index unexisting documents that were inserted before the collection drop. EDIT: Well this is related with this #47 |
Hi, I have posted the question to MongoDB user group [1]. [1] - https://groups.google.com/forum/?fromgroups#!topic/mongodb-user/-zj9ojkfN_g Thanks, |
I've made a fast fork with little changes for getting notified of the drop collection event. I had to get rid of the id field because it's not used in oplog.rs when reporting a drop collection event. https://github.com/Quaiks/elasticsearch-river-mongodb-drop-collection-event |
Hi, Thanks I will merge the changes. Thanks, On Fri, May 17, 2013 at 10:43 AM, Enrique Fernández-Polo Puertas <
|
- Enable drop collection feature using drop_collection: true in options attribute (see test-simple-mongodb-river-drop-collection.json)
Works for me. #!/bin/sh
curl -XPUT "http://localhost:9200/_river/product-$type/_meta" -d '
{
"type": "mongodb",
"mongodb": {
"servers": [
{ "host": "127.0.0.1", "port": 27017 }
],
"options": { "secondary_read_preference": true, "drop_collection": true },
"db": "product",
"collection": "'$type'"
},
"index": {
"name": "product",
"type": "'$type'"
}
}' |
Once I've dropped the database, then I re-create the collection, new records don't seem to sync any more. Is the patch starting sync operations again once the collection is re-created? |
The river always uses oplog.rs collection. Can you please just clarify your scenario before I take a look? Thanks, |
Sure, I've noticed another issue with this feature too. Maybe I'm using it wrong, let me explain. Scenario 1
Expected: Zero documents indexed in elastic Scenario 2
Expected: Zero documents indexed in elastic
Expected: A single document indexed in elastic Scenario 3
Expected: Mapping remains as set when index was created |
This feature only works when dropping collections and no databases. |
Hi, @Quaiks is correct the river only monitor "drop collection" action from oplog.rs. Thanks, |
Cool, thanks I'll test that out. |
Hi, You are probably missing mapper.dynamic = false [1]. |
I am still having issues with scenario #2, when I use Note: I am not dropping the db, just the collection with: mongo> use foo
mongo> db.bar.drop() |
Hi, I believe you found a bug. I have committed a fix. Thanks, |
Fix is available in release 1.6.11. Thanks, |
Sorry for the delay, have been enjoying the British heatwave in the Lake District. |
Great, upgraded to |
We realize that when we drop a MongoDB collection through shell the index is not refreshed. We expect that if I remove a MongoDB collection from the shell then the index should be deleted.
The text was updated successfully, but these errors were encountered: