<p dir="auto">First I just indexed 2 documents:<br>
curl -XPUT <a href="http://192.168.0.118:9200/test/company/apple" rel="nofollow">http://192.168.0.118:9200/test/company/apple</a> -d '{data:"Apple corp"}'<br>
curl -XPUT <a href="http://192.168.0.118:9200/test/fruit/apple" rel="nofollow">http://192.168.0.118:9200/test/fruit/apple</a> -d '{data:"Just red apple"}'</p>
<p dir="auto">According to example above we have test index with 2 documents (both with "apple" id) in different types.<br>
When we make curl -XGET <a href="http://192.168.0.118:9200/test/_mget?pretty" rel="nofollow">http://192.168.0.118:9200/test/_mget?pretty</a> -d '{ids:["apple","apple"]}'<br>
We see this:<br>
{<br>
"docs" : [ {<br>
"_index" : "test",<br>
"_type" : "fruit",<br>
"_id" : "apple",<br>
"_version" : 1,<br>
"found" : true, "_source" : {data:"Just red apple"}<br>
}, {<br>
"_index" : "test",<br>
"_type" : "fruit",<br>
"_id" : "apple",<br>
"_version" : 1,<br>
"found" : true, "_source" : {data:"Just red apple"}<br>
} ]<br>
}</p>
<p dir="auto">As you can see documents are duplicated.<br>
So if we request curl -XGET <a href="http://192.168.0.118:9200/test/_mget?pretty" rel="nofollow">http://192.168.0.118:9200/test/_mget?pretty</a> -d '{ids:["apple","apple","apple"]}' we will see 3 documents in result set and so on.</p>
<p dir="auto">I think the right way to resolve this issue is to ignore duplicate identificators in "ids" parameter.</p>
<p dir="auto">First I just indexed 2 documents:<br>
curl -XPUT <a href="http://192.168.0.118:9200/test/company/apple" rel="nofollow">http://192.168.0.118:9200/test/company/apple</a> -d '{data:"Apple corp"}'<br>
curl -XPUT <a href="http://192.168.0.118:9200/test/fruit/apple" rel="nofollow">http://192.168.0.118:9200/test/fruit/apple</a> -d '{data:"Just red apple"}'</p>
<p dir="auto">As you can see, they have same id and placed in same index,but different types.<br>
Ok, next I perform multi get request:</p>
<p dir="auto">curl -XGET <a href="http://192.168.0.118:9200/test/_mget?pretty" rel="nofollow">http://192.168.0.118:9200/test/_mget?pretty</a> -d '{ids:["apple"]}'</p>
<p dir="auto">Response:</p>
<p dir="auto">{<br>
"docs" : [ {<br>
"_index" : "test",<br>
"_type" : "fruit",<br>
"_id" : "apple",<br>
"_version" : 1,<br>
"found" : true, "_source" : {data:"Just red apple"}<br>
} ]<br>
}</p>
<p dir="auto">As you can see only one document returned. Why not both? I find such behavior very ambiguous. I think if we request whole index, so all documents with given id should be returned regardless of type.</p>