Total hits from _search_shard API and _search API are different

I was trying to experiment the scripts given in this tutorial.

I am using ES v2.3.2.

When I execute a matchAllQuery with scroll with size 50 on the _search API, I get the total documents in the index and hits with 50 documents. I assume that if I run the same query on _search_shard API with the appropriate routing value, I should be getting the total no. of documents in a specific shard and 50 hits in that shard?

I have a small index that has 2276 documents. I have a total of 16 shards, so executing the matchAllQuery query with the _search_shard API for each shard I get:

Shard   Total Matches
1       160
2       137
3       137
4       142
5       137
6       134
7       134
8       149
9       140
10      142
11      134
12      137
13      115
14      156
15      140
16      125

which sums to 2219 documents. I was expecting this to be 2276 instead. I there any concept that I have misunderstood?

Another thing is that all of the responses have a field terminated_early: true. Could this be an issue here?

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