# Filter results list

**URL:** <https://discuss.elastic.co/t/filter-results-list/4454>\
**Category:** Elasticsearch\
**Created:** [May 22, 2011, 6:09am UTC](https://discuss.elastic.co/t/filter-results-list/4454 "2011-05-22T06:09:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Karma](https://avatars.discourse-cdn.com/v4/letter/k/bcef8e/32.png) [@Karma](https://discuss.elastic.co/u/Karma)\
**Post date:** [May 22, 2011, 6:09am UTC](https://discuss.elastic.co/t/filter-results-list/4454/1 "2011-05-22T06:09:44Z")

</div>

Let's say after query i get a bunch of documents (web pages) but some  
of them having same excerpts and score within same domain and i need  
to filter them out living only the first of such occurences, how do i  
accomplish that?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Karma](https://avatars.discourse-cdn.com/v4/letter/k/bcef8e/32.png) [@Karma](https://discuss.elastic.co/u/Karma)\
**Post date:** [May 22, 2011, 8:05am UTC](https://discuss.elastic.co/t/filter-results-list/4454/2 "2011-05-22T08:05:52Z")

</div>

can i scan through list of result and do something like this?

var previous\_domain  
var previous\_score

func filterspam(currentdoc) {  
if currentdoc.domain == previous\_domain && currentdoc.score ==  
previous\_score {  
skipdoc(currentdoc)  
return  
}  
previous\_domain = currentdoc.domain  
previous\_score = currentdoc.score  
return  
}

On May 22, 2:09 pm, Karma [akmal...@gmail.com](mailto:akmal...@gmail.com) wrote:

> Let's say after query i get a bunch of documents (web pages) but some  
> of them having same excerpts and score within same domain and i need  
> to filter them out living only the first of such occurences, how do i  
> accomplish that?
> 
> Thanks in advance.

---

<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, 4:05am UTC](https://discuss.elastic.co/t/filter-results-list/4454/3 "2017-07-06T04:05:37Z")

</div>

Closed on July 6, 2017, 4:05am UTC


