# Problem with indexed documents, after calling drop on collection

**URL:** <https://discuss.elastic.co/t/problem-with-indexed-documents-after-calling-drop-on-collection/12548>\
**Category:** Elasticsearch\
**Created:** [June 26, 2013, 8:17am UTC](https://discuss.elastic.co/t/problem-with-indexed-documents-after-calling-drop-on-collection/12548 "2013-06-26T08:17:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Taras\_Petrytsyn](https://avatars.discourse-cdn.com/v4/letter/t/848f3c/32.png) [@Taras\_Petrytsyn](https://discuss.elastic.co/u/Taras_Petrytsyn)\
**Post date:** [June 26, 2013, 8:17am UTC](https://discuss.elastic.co/t/problem-with-indexed-documents-after-calling-drop-on-collection/12548/1 "2013-06-26T08:17:47Z")

</div>

Hi everyone,  
I'm using elasticsearch mongodb river. After calling drop() on my  
collection all the documents that was dropped are still in index, even  
after removing of index and creating new one they still appears in results.  
I suspect that somehow drop() command not affect oplog file(which is used  
by mongodb river) that is why these documents are still in index. Are there  
any ideas how can I make index not "see" these dropped documents?  
Thank you,  
Taras

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 26, 2013, 8:30am UTC](https://discuss.elastic.co/t/problem-with-indexed-documents-after-calling-drop-on-collection/12548/2 "2013-06-26T08:30:18Z")

</div>

You probably deleted the \_river index not the index itself.  
Removing an index removes all your documents (rm -rf behind the scene).

My 2 cents

--  
David 😉  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 26 juin 2013 à 10:17, Taras Petrytsyn [pegasus.ua@gmail.com](mailto:pegasus.ua@gmail.com) a écrit :

> ## Hi everyone, I'm using elasticsearch mongodb river. After calling drop() on my collection all the documents that was dropped are still in index, even after removing of index and creating new one they still appears in results. I suspect that somehow drop() command not affect oplog file(which is used by mongodb river) that is why these documents are still in index. Are there any ideas how can I make index not "see" these dropped documents? Thank you, Taras
> 
> You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Taras\_Petrytsyn](https://avatars.discourse-cdn.com/v4/letter/t/848f3c/32.png) [@Taras\_Petrytsyn](https://discuss.elastic.co/u/Taras_Petrytsyn)\
**Post date:** [June 26, 2013, 8:42am UTC](https://discuss.elastic.co/t/problem-with-indexed-documents-after-calling-drop-on-collection/12548/3 "2013-06-26T08:42:15Z")

</div>

Hi David,  
no actually I also removed index. And when I created newone, these  
documents were already in index ☹ as I mentioned before I think problem is  
in oplog, because as I understood, mongodb river doesn't work directly with  
data, but use oplog. And in case of calling drop() command documents that  
were dropped aren't identified by river as deleted. Interesting, that in  
case of calling remove() command (without parameters it removes all  
documents) threre is no problem.  
Thank you,  
Taras

Середа, 26 червня 2013 р. 11:30:18 UTC+3 користувач David Pilato написав:

> You probably deleted the \_river index not the index itself.  
> Removing an index removes all your documents (rm -rf behind the scene).
> 
> My 2 cents
> 
> --  
> David 😉  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> 
> Le 26 juin 2013 à 10:17, Taras Petrytsyn \<[pegas...@gmail.com](mailto:pegas...@gmail.com) \<javascript:\>\>  
> a écrit :
> 
> Hi everyone,  
> I'm using elasticsearch mongodb river. After calling drop() on my  
> collection all the documents that was dropped are still in index, even  
> after removing of index and creating new one they still appears in results.  
> I suspect that somehow drop() command not affect oplog file(which is used  
> by mongodb river) that is why these documents are still in index. Are there  
> any ideas how can I make index not "see" these dropped documents?  
> Thank you,  
> Taras
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 26, 2013, 8:50am UTC](https://discuss.elastic.co/t/problem-with-indexed-documents-after-calling-drop-on-collection/12548/4 "2013-06-26T08:50:50Z")

</div>

If you remove the index, docs in Elasticsearch should be removed.  
If not, there's something weird here.

Could you share curl commands you are running to delete the index?

You're right about oplog thing. Removing a database in mongodb won't remove the index in ES AFAIK.

May be after you removed the index, all documents are again fetched from the oplog by the river?

--  
David 😉  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 26 juin 2013 à 10:42, Taras Petrytsyn [pegasus.ua@gmail.com](mailto:pegasus.ua@gmail.com) a écrit :

> Hi David,  
> no actually I also removed index. And when I created newone, these documents were already in index ☹ as I mentioned before I think problem is in oplog, because as I understood, mongodb river doesn't work directly with data, but use oplog. And in case of calling drop() command documents that were dropped aren't identified by river as deleted. Interesting, that in case of calling remove() command (without parameters it removes all documents) threre is no problem.  
> Thank you,  
> Taras
> 
> Середа, 26 червня 2013 р. 11:30:18 UTC+3 користувач David Pilato написав:
> 
> > You probably deleted the \_river index not the index itself.  
> > Removing an index removes all your documents (rm -rf behind the scene).
> > 
> > My 2 cents
> > 
> > --  
> > David 😉  
> > Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> > 
> > Le 26 juin 2013 à 10:17, Taras Petrytsyn [pegas...@gmail.com](mailto:pegas...@gmail.com) a écrit :
> > 
> > > ## Hi everyone, I'm using elasticsearch mongodb river. After calling drop() on my collection all the documents that was dropped are still in index, even after removing of index and creating new one they still appears in results. I suspect that somehow drop() command not affect oplog file(which is used by mongodb river) that is why these documents are still in index. Are there any ideas how can I make index not "see" these dropped documents? Thank you, Taras
> > > 
> > > You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Taras\_Petrytsyn](https://avatars.discourse-cdn.com/v4/letter/t/848f3c/32.png) [@Taras\_Petrytsyn](https://discuss.elastic.co/u/Taras_Petrytsyn)\
**Post date:** [June 26, 2013, 9:05am UTC](https://discuss.elastic.co/t/problem-with-indexed-documents-after-calling-drop-on-collection/12548/5 "2013-06-26T09:05:37Z")

</div>

I removed index using UI controls of head plugin.

- May be after you removed the index, all documents are again fetched from  
the oplog by the river?  
I think so too. But don't know how to handle fetching of documents that  
were dropped.

Середа, 26 червня 2013 р. 11:50:50 UTC+3 користувач David Pilato написав:

> If you remove the index, docs in Elasticsearch should be removed.  
> If not, there's something weird here.
> 
> Could you share curl commands you are running to delete the index?
> 
> You're right about oplog thing. Removing a database in mongodb won't  
> remove the index in ES AFAIK.
> 
> May be after you removed the index, all documents are again fetched from  
> the oplog by the river?
> 
> --  
> David 😉  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> 
> Le 26 juin 2013 à 10:42, Taras Petrytsyn \<[pegas...@gmail.com](mailto:pegas...@gmail.com) \<javascript:\>\>  
> a écrit :
> 
> Hi David,  
> no actually I also removed index. And when I created newone, these  
> documents were already in index ☹ as I mentioned before I think problem is  
> in oplog, because as I understood, mongodb river doesn't work directly with  
> data, but use oplog. And in case of calling drop() command documents that  
> were dropped aren't identified by river as deleted. Interesting, that in  
> case of calling remove() command (without parameters it removes all  
> documents) threre is no problem.  
> Thank you,  
> Taras
> 
> Середа, 26 червня 2013 р. 11:30:18 UTC+3 користувач David Pilato написав:
> 
> > You probably deleted the \_river index not the index itself.  
> > Removing an index removes all your documents (rm -rf behind the scene).
> > 
> > My 2 cents
> > 
> > --  
> > David 😉  
> > Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> > 
> > Le 26 juin 2013 à 10:17, Taras Petrytsyn [pegas...@gmail.com](mailto:pegas...@gmail.com) a écrit :
> > 
> > Hi everyone,  
> > I'm using elasticsearch mongodb river. After calling drop() on my  
> > collection all the documents that was dropped are still in index, even  
> > after removing of index and creating new one they still appears in results.  
> > I suspect that somehow drop() command not affect oplog file(which is used  
> > by mongodb river) that is why these documents are still in index. Are there  
> > any ideas how can I make index not "see" these dropped documents?  
> > Thank you,  
> > Taras
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 2:29am UTC](https://discuss.elastic.co/t/problem-with-indexed-documents-after-calling-drop-on-collection/12548/6 "2017-07-06T02:29:26Z")

</div>


