# Find only those documents which do not contains id of some other nodes among results

**URL:** <https://discuss.elastic.co/t/find-only-those-documents-which-do-not-contains-id-of-some-other-nodes-among-results/17442>\
**Category:** Elasticsearch\
**Created:** [May 10, 2014, 4:11am UTC](https://discuss.elastic.co/t/find-only-those-documents-which-do-not-contains-id-of-some-other-nodes-among-results/17442 "2014-05-10T04:11:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zoran\_Jeremic](https://avatars.discourse-cdn.com/v4/letter/z/7ba0ec/32.png) [@Zoran\_Jeremic](https://discuss.elastic.co/u/Zoran_Jeremic)\
**Post date:** [May 10, 2014, 4:11am UTC](https://discuss.elastic.co/t/find-only-those-documents-which-do-not-contains-id-of-some-other-nodes-among-results/17442/1 "2014-05-10T04:11:57Z")

</div>

Hi guys,

I just solved one problem and got into the other, but I hope this would be  
a peace of cake for some of you with more experience with ES.  
I have documents that look like this:  
{  
"\_id":"document\_A\_id",  
"title":"Document A",  
...  
"duplicates": []  
}

{  
"\_id":"document\_B\_id",  
"title":"Document B",  
...  
"duplicateof":  
[  
{"id":"document\_A\_id"},  
{"id":"document\_C\_id"}  
]  
}

I'm using Java API to create a query which combines more like this text  
query and different filters in order to select certain number of documents  
with the highest score. In the given example document B is marked as  
duplicate of document A, as it has a list "duplicateof" where id of  
document A is stored. If these two documents are happened to be in the top  
results I want to skip document B.

Does anybody have an idea how I can make this?

Thanks,  
Zoran

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/7c4e5a84-acee-4653-8656-dc33db58549a%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/7c4e5a84-acee-4653-8656-dc33db58549a%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 1:30am UTC](https://discuss.elastic.co/t/find-only-those-documents-which-do-not-contains-id-of-some-other-nodes-among-results/17442/2 "2017-07-06T01:30:21Z")

</div>


