elasticsearch-river-mongodb icon indicating copy to clipboard operation
elasticsearch-river-mongodb copied to clipboard

DropCollection dropped all indexes from that database?

Open harshjari opened this issue 10 years ago • 1 comments

My versions are : mongo 2.6.5, es 1.3.5

I used the following to create 3 indexes:

curl -XPUT "http://localhost:9200/_river/perf_a_river/_meta" -d'
{
   "type": "mongodb",
   "mongodb": {
     "servers": [
       { "host": "127.0.0.1", "port":"27017" }
     ],
     "credentials":
     [
       { "db": "admin", "user":"XXXX", "password":"XXXX" }
     ],
     "options": {
        "secondary_read_preference": true,
        "drop_collection":true
     },
     "script":"setupAFields",
     "db": "asd_perf_staging",
     "collection": "a"
   },
   "index": {
     "name": "asd_perf_a",
     "type": "asd_perf_a"
   }
}'
curl -XPUT "http://localhost:9200/_river/perf_p_river/_meta" -d'
{
   "type": "mongodb",
   "mongodb": {
     "servers": [
       { "host": "127.0.0.1", "port":"27017" }
     ],
     "credentials":
     [
       { "db": "admin", "user":"XXXX", "password":"XXXX" }
     ],
     "options": {
        "secondary_read_preference": true,
        "drop_collection":true
     },
     "script":"setupPFields",
     "db": "asd_perf_staging",
     "collection": "p"
   },
   "index": {
     "name": "asd_perf_p",
     "type": "asd_perf_p"
   }
}'
curl -XPUT "http://localhost:9200/_river/perf_r_river/_meta" -d'
{
   "type": "mongodb",
   "mongodb": {
     "servers": [
       { "host": "127.0.0.1", "port":"27017" }
     ],
     "credentials":
     [
       { "db": "admin", "user":"XXXX", "password":"XXXX" }
     ],
     "options": {
        "secondary_read_preference": true,
        "drop_collection":true
     },
     "script":"setupRFields",
     "db": "asd_perf_staging",
     "collection": "r"
   },
   "index": {
     "name": "asd_perf_r",
     "type": "asd_perf_r"
   }
}'

Once they were created, to test dropcollection, i ran db.r.drop(). This dropped the R collection as expected in mongo and the A and P collections are fine. BUT in elasticsearch it dropped ALL 3 of the above indexes as well. They are all at 0 indexed documents. What am I doing wrong here? Or is this a bug? If so, how do i get past it?

More testing shows that no matter what collection im dropping, this will happen. Even if its a collection that is NOT being imported into an ES index.

harshjari avatar Feb 12 '15 23:02 harshjari

Looks like a bug.

richardwilly98 avatar Feb 26 '15 09:02 richardwilly98