ElasticSearch Query string returns total hits different than scroll

Hi There,
I run query string against new ES V7 which expected to return 25k result set, but only returns total hit 1000, when running the same query but using scroll, it returns the expected correct count of 25k as a total hit. Please find the following output. It used to work fine in ES V6. How can I get total 25k hits for regular query_string search (without scroll)?

GET author/_search
{
  "query": {
    "query_string": {
      "default_field": "audoc.authlast",
      "query": "audoc.authlast:smith"
    }
  }
}

----- result

"hits" : { "total" : { "value" : 10000, "relation" : "gte" }

GET author/_search?scroll=2m { "size": 10000, "stored_fields": ["audoc.auid"], "query": { "query_string": { "default_field": "audoc.authlast", "query": "audoc.authlast:smith" } } }

------ result
"hits" : { "total" : { "value" : 25983, "relation" : "eq" }

Run this:

GET author/_search
{
  "track_total_hits": true,
  "query": {
    "query_string": {
      "default_field": "audoc.authlast",
      "query": "audoc.authlast:smith"
    }
  }
}

See

1 Like

Great! I have tried adding the new attribute "track_total_hits:true" and that worked! thanks