# Same document repeated in search results

**URL:** <https://discuss.elastic.co/t/same-document-repeated-in-search-results/15946>\
**Category:** Elasticsearch\
**Created:** [February 21, 2014, 10:57am UTC](https://discuss.elastic.co/t/same-document-repeated-in-search-results/15946 "2014-02-21T10:57:35Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pir\_Abdul\_Rasool\_Qur](https://avatars.discourse-cdn.com/v4/letter/p/ac91a4/32.png) [@Pir\_Abdul\_Rasool\_Qur](https://discuss.elastic.co/u/Pir_Abdul_Rasool_Qur)\
**Post date:** [February 21, 2014, 10:57am UTC](https://discuss.elastic.co/t/same-document-repeated-in-search-results/15946/1 "2014-02-21T10:57:35Z")

</div>

Hi I am getting same document (with same "\_id") repeated more than once in  
search results.

My query looks like

POST [http://XXXX:9200/\_search/](http://XXXX:9200/_search/)  
{  
"query": {  
"multi\_match" : {  
"fields":[  
"en\_text\_keywords\_1^12",  
"en\_text\_keywords\_2^8",  
"en\_text\_keywords\_3^6",  
"en\_text\_keywords\_4^4",  
"en\_text\_keywords\_5^2",  
"en\_text\_title^12"  
],  
"query":"animals"  
}  
},  
"size": 1000  
}

Is it a bug? or something I am missing?

Thanks

--  
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/8c1c3f24-eb33-4035-bc9a-dc7fa26b6a87%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/8c1c3f24-eb33-4035-bc9a-dc7fa26b6a87%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Pir\_Abdul\_Rasool\_Qur](https://avatars.discourse-cdn.com/v4/letter/p/ac91a4/32.png) [@Pir\_Abdul\_Rasool\_Qur](https://discuss.elastic.co/u/Pir_Abdul_Rasool_Qur)\
**Post date:** [February 21, 2014, 11:37am UTC](https://discuss.elastic.co/t/same-document-repeated-in-search-results/15946/2 "2014-02-21T11:37:09Z")

</div>

I deleted the document and re-inserted it, it actually solved the issue  
with that particular document. But now there is one more document that has  
same problem. Ou results looks like containing :  
...  
{  
"\_index": "twitter",  
"\_type": "tweet",  
"\_id": "1739753",  
"\_score": 8.071245,  
"fields": {  
"en\_text\_title": [  
"Young tiger portrait"  
]  
}  
},  
{  
"\_index": "twitter",  
"\_type": "tweet",  
"\_id": "1739753",  
"\_score": 8.071245,  
"fields": {  
"en\_text\_title": [  
"Young tiger portrait"  
]  
}  
},  
...

Another important thing to mention here is that we have a multithreaded  
application sending the documents to elasticsearch . Therefore there are  
chances that we may send the same document more than once.

Thanks  
Pir.

On Friday, February 21, 2014 11:57:35 AM UTC+1, Pir Abdul Rasool Qureshi  
wrote:

> Hi I am getting same document (with same "\_id") repeated more than once in  
> search results.
> 
> My query looks like
> 
> POST [http://XXXX:9200/\_search/](http://XXXX:9200/_search/)  
> {  
> "query": {  
> "multi\_match" : {  
> "fields":[  
> "en\_text\_keywords\_1^12",  
> "en\_text\_keywords\_2^8",  
> "en\_text\_keywords\_3^6",  
> "en\_text\_keywords\_4^4",  
> "en\_text\_keywords\_5^2",  
> "en\_text\_title^12"  
> ],  
> "query":"animals"  
> }  
> },  
> "size": 1000  
> }
> 
> Is it a bug? or something I am missing?
> 
> Thanks

--  
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/0b154ae4-fd99-4f9a-830f-69e949e26b8b%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0b154ae4-fd99-4f9a-830f-69e949e26b8b%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Pir\_Abdul\_Rasool\_Qur](https://avatars.discourse-cdn.com/v4/letter/p/ac91a4/32.png) [@Pir\_Abdul\_Rasool\_Qur](https://discuss.elastic.co/u/Pir_Abdul_Rasool_Qur)\
**Post date:** [February 21, 2014, 11:55am UTC](https://discuss.elastic.co/t/same-document-repeated-in-search-results/15946/3 "2014-02-21T11:55:27Z")

</div>

We have 3 nodes in Elasticsearch cluster, (with number\_of\_replicas = 2 and  
number of shards = 8). I stopped both replicas and executed the same  
query but the problem was still there.

On Friday, February 21, 2014 11:57:35 AM UTC+1, Pir Abdul Rasool Qureshi  
wrote:

> Hi I am getting same document (with same "\_id") repeated more than once in  
> search results.
> 
> My query looks like
> 
> POST [http://XXXX:9200/\_search/](http://XXXX:9200/_search/)  
> {  
> "query": {  
> "multi\_match" : {  
> "fields":[  
> "en\_text\_keywords\_1^12",  
> "en\_text\_keywords\_2^8",  
> "en\_text\_keywords\_3^6",  
> "en\_text\_keywords\_4^4",  
> "en\_text\_keywords\_5^2",  
> "en\_text\_title^12"  
> ],  
> "query":"animals"  
> }  
> },  
> "size": 1000  
> }
> 
> Is it a bug? or something I am missing?
> 
> Thanks

--  
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/2c49db40-3ddd-4b88-8428-2d68ce72f821%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/2c49db40-3ddd-4b88-8428-2d68ce72f821%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Binh\_Ly](https://avatars.discourse-cdn.com/v4/letter/b/ce7236/32.png) [@Binh\_Ly](https://discuss.elastic.co/u/Binh_Ly)\
**Post date:** [February 21, 2014, 6:53pm UTC](https://discuss.elastic.co/t/same-document-repeated-in-search-results/15946/4 "2014-02-21T18:53:22Z")

</div>

May I ask which version of ES? And also are you using the REST API to index  
the documents with an explicit ID?

--  
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/7d86859a-b12b-4a37-83dd-1d62c29ec06f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/7d86859a-b12b-4a37-83dd-1d62c29ec06f%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Hannes\_Korte](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hannes_korte/32/909_2.png) [@Hannes\_Korte](https://discuss.elastic.co/u/Hannes_Korte)\
**Post date:** [February 21, 2014, 7:35pm UTC](https://discuss.elastic.co/t/same-document-repeated-in-search-results/15946/5 "2014-02-21T19:35:36Z")

</div>

Hi,

do you specify a custom routing parameter when indexing the documents?  
If so, you might have documents with the same ID in different shards:

"When indexing documents specifying a custom \_routing, the uniqueness of  
the \_id is not guaranteed throughout all the shards that the index is  
composed of. In fact, documents with the same \_id might end up in  
different shards if indexed with different \_routing values."

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

Best regards,  
Hannes

On 21.02.2014 11:57, Pir Abdul Rasool Qureshi wrote:

> Hi I am getting same document (with same "\_id") repeated more than once in  
> search results.
> 
> My query looks like
> 
> POST [http://XXXX:9200/\_search/](http://XXXX:9200/_search/)  
> {  
> "query": {  
> "multi\_match" : {  
> "fields":[  
> "en\_text\_keywords\_1^12",  
> "en\_text\_keywords\_2^8",  
> "en\_text\_keywords\_3^6",  
> "en\_text\_keywords\_4^4",  
> "en\_text\_keywords\_5^2",  
> "en\_text\_title^12"  
> ],  
> "query":"animals"  
> }  
> },  
> "size": 1000  
> }
> 
> Is it a bug? or something I am missing?
> 
> Thanks

--  
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/5307AA88.2070809%40hkorte.com](https://groups.google.com/d/msgid/elasticsearch/5307AA88.2070809%40hkorte.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Pir\_Abdul\_Rasool\_Qur](https://avatars.discourse-cdn.com/v4/letter/p/ac91a4/32.png) [@Pir\_Abdul\_Rasool\_Qur](https://discuss.elastic.co/u/Pir_Abdul_Rasool_Qur)\
**Post date:** [February 22, 2014, 1:53pm UTC](https://discuss.elastic.co/t/same-document-repeated-in-search-results/15946/6 "2014-02-22T13:53:08Z")

</div>

We are using Elastic Search version 1.0, Elasticsearch official php-client  
([Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/client/php-api/current/index.html))  
version 1.0 and BulkApi.  
We are not specifying any custom routing. Our request looks like this:

{"index":{"\_index":"twitter","\_type":"tweet","\_id":"1739753"}}  
{"field1":"value1" ... "field n":"value"}

I need help to understand,  
why while using GET API, we find only one document, whereas, while  
searching same document appears twice?  
why does overwriting the same document fixes the issue with that document?  
Is there any way to ensure the \_id uniqueness throughout the index?

On Friday, February 21, 2014 8:35:36 PM UTC+1, Hannes Korte wrote:

> Hi,
> 
> do you specify a custom routing parameter when indexing the documents?  
> If so, you might have documents with the same ID in different shards:
> 
> "When indexing documents specifying a custom \_routing, the uniqueness of  
> the \_id is not guaranteed throughout all the shards that the index is  
> composed of. In fact, documents with the same \_id might end up in  
> different shards if indexed with different \_routing values."
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-routing-field.html)
> 
> Best regards,  
> Hannes
> 
> On 21.02.2014 11:57, Pir Abdul Rasool Qureshi wrote:
> 
> > Hi I am getting same document (with same "\_id") repeated more than once  
> > in  
> > search results.
> > 
> > My query looks like
> > 
> > POST [http://XXXX:9200/\_search/](http://XXXX:9200/_search/)  
> > {  
> > "query": {  
> > "multi\_match" : {  
> > "fields":[  
> > "en\_text\_keywords\_1^12",  
> > "en\_text\_keywords\_2^8",  
> > "en\_text\_keywords\_3^6",  
> > "en\_text\_keywords\_4^4",  
> > "en\_text\_keywords\_5^2",  
> > "en\_text\_title^12"  
> > ],  
> > "query":"animals"  
> > }  
> > },  
> > "size": 1000  
> > }
> > 
> > Is it a bug? or something I am missing?
> > 
> > Thanks

--  
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/6a7095a2-aaa0-4912-a60f-ff16f7e85b3a%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6a7095a2-aaa0-4912-a60f-ff16f7e85b3a%40googlegroups.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:** [February 22, 2014, 2:00pm UTC](https://discuss.elastic.co/t/same-document-repeated-in-search-results/15946/7 "2014-02-22T14:00:54Z")

</div>

They are unique.

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

Le 22 févr. 2014 à 14:53, Pir Abdul Rasool Qureshi [pir@colourbox.com](mailto:pir@colourbox.com) a écrit :

We are using Elastic Search version 1.0, Elasticsearch official php-client ([Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/client/php-api/current/index.html)) version 1.0 and BulkApi.  
We are not specifying any custom routing. Our request looks like this:

{"index":{"\_index":"twitter","\_type":"tweet","\_id":"1739753"}}  
{"field1":"value1" ... "field n":"value"}

I need help to understand,  
why while using GET API, we find only one document, whereas, while searching same document appears twice?  
why does overwriting the same document fixes the issue with that document?  
Is there any way to ensure the \_id uniqueness throughout the index?

> On Friday, February 21, 2014 8:35:36 PM UTC+1, Hannes Korte wrote:  
> Hi,
> 
> do you specify a custom routing parameter when indexing the documents?  
> If so, you might have documents with the same ID in different shards:
> 
> "When indexing documents specifying a custom \_routing, the uniqueness of  
> the \_id is not guaranteed throughout all the shards that the index is  
> composed of. In fact, documents with the same \_id might end up in  
> different shards if indexed with different \_routing values."
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-routing-field.html)
> 
> Best regards,  
> Hannes
> 
> On 21.02.2014 11:57, Pir Abdul Rasool Qureshi wrote:
> 
> > Hi I am getting same document (with same "\_id") repeated more than once in  
> > search results.
> > 
> > My query looks like
> > 
> > POST [http://XXXX:9200/\_search/](http://XXXX:9200/_search/)  
> > {  
> > "query": {  
> > "multi\_match" : {  
> > "fields":[  
> > "en\_text\_keywords\_1^12",  
> > "en\_text\_keywords\_2^8",  
> > "en\_text\_keywords\_3^6",  
> > "en\_text\_keywords\_4^4",  
> > "en\_text\_keywords\_5^2",  
> > "en\_text\_title^12"  
> > ],  
> > "query":"animals"  
> > }  
> > },  
> > "size": 1000  
> > }
> > 
> > Is it a bug? or something I am missing?
> > 
> > Thanks

--  
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/6a7095a2-aaa0-4912-a60f-ff16f7e85b3a%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6a7095a2-aaa0-4912-a60f-ff16f7e85b3a%40googlegroups.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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/E4162F2F-B9AD-41CE-AE88-542EE2031D77%40pilato.fr](https://groups.google.com/d/msgid/elasticsearch/E4162F2F-B9AD-41CE-AE88-542EE2031D77%40pilato.fr).  
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, 1:48am UTC](https://discuss.elastic.co/t/same-document-repeated-in-search-results/15946/8 "2017-07-06T01:48:06Z")

</div>


