Search result does not contain all hits for page

544 Views Asked by At

Doing a fairly standard search query on my ElasticSearch index:

GET /myIndex/myType/_search?q=nameEnglish:stir

I get a response like:

{
    "hits": {
        "total": 2,
        "max_score": 1.8492403,
        "hits": [...1 object...]
    },
    "_shards": {
        "total": 1,
        "successful": 1,
        "failed": 0
    },
    "timed_out": false,
    "took": 1
}

So, it's telling me there were two matches, but it's only returning one. If I want to get the other hit I have to run the query with &from=1. As I understand it, the default page size for ElasticSearch is 10 records, so why is it only returning 1?

Adding a &size= parameter doesn't affect the result. I can also reproduce this with other queries (i.e. the number of "hits" returned being less than the page size), and the number of records returned will vary depending on whether I add a sort parameter to the query.

I'm testing this on a Searchly-hosted ES index.

1

There are 1 best solutions below

0
On

With default configuration of ES 1.2.1 (Win), you get 5 hits when I try your query. Perhaps it is in the configuration of Searchly.

Try to query with the POST request. The answer should have the header similar (max 5 successful), but you should receive 10 (or more) resonses depending on the size parameter.