# How to remove duplicate search result in elasticsearch?

**URL:** https://discuss.elastic.co/t/how-to-remove-duplicate-search-result-in-elasticsearch/252319
**Category:** Elasticsearch
**Created:** [October 16, 2020, 9:10am UTC](https://discuss.elastic.co/t/how-to-remove-duplicate-search-result-in-elasticsearch/252319 "2020-10-16T09:10:18Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![yen\_l\_ng\_th](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yen_l_ng_th/32/65467_2.png) [@yen\_l\_ng\_th](https://discuss.elastic.co/u/yen_l_ng_th)
#### Post date: [October 16, 2020, 9:10am UTC](https://discuss.elastic.co/t/how-to-remove-duplicate-search-result-in-elasticsearch/252319/1 "2020-10-16T09:10:18Z")

</div>

I use a paginated search by elasticseach. But the items are duplicated between pages. It is at the bottom of this page and at the top of the other page.  
I did like this but it still doesn't work  
$aggregations = [  
"unique\_id"=\>[  
"terms"=\>[  
"field"=\>"id"  
]  
]  
];  
Is there a way to solve this problem?

---

<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: [October 16, 2020, 11:14am UTC](https://discuss.elastic.co/t/how-to-remove-duplicate-search-result-in-elasticsearch/252319/2 "2020-10-16T11:14:43Z")

</div>

Is it happening because you are still indexing new data while going from one page to another?

---

<div class="post-metadata">

### Author: ![yen\_l\_ng\_th](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yen_l_ng_th/32/65467_2.png) [@yen\_l\_ng\_th](https://discuss.elastic.co/u/yen_l_ng_th)
#### Post date: [October 17, 2020, 2:15am UTC](https://discuss.elastic.co/t/how-to-remove-duplicate-search-result-in-elasticsearch/252319/3 "2020-10-17T02:15:18Z")

</div>

right. I have that problem

---

<div class="post-metadata">

### Author: ![yen\_l\_ng\_th](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yen_l_ng_th/32/65467_2.png) [@yen\_l\_ng\_th](https://discuss.elastic.co/u/yen_l_ng_th)
#### Post date: [October 17, 2020, 2:43am UTC](https://discuss.elastic.co/t/how-to-remove-duplicate-search-result-in-elasticsearch/252319/4 "2020-10-17T02:43:38Z")

</div>

Is it true if I use it like this?  
$aggregations = [  
"dedup"=\>[  
"terms"=\>[  
"field"=\>"id"  
]  
]  
];

---

<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: [October 20, 2020, 1:49pm UTC](https://discuss.elastic.co/t/how-to-remove-duplicate-search-result-in-elasticsearch/252319/5 "2020-10-20T13:49:37Z")

</div>

So in the next 7.10 version, you will be able to use the new [Point In Time API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/point-in-time-api.html).

For now, you can use the scroll API but it does not have the same "flexibility" of the new API as you can just move forward and not backward. See

> **[Paginate search results | Elasticsearch Reference \[7.9\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/7.9/paginate-search-results.html#scroll-search-results)**

---

<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: [November 17, 2020, 1:49pm UTC](https://discuss.elastic.co/t/how-to-remove-duplicate-search-result-in-elasticsearch/252319/6 "2020-11-17T13:49:38Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
