Once in a while i get the following error:
numHits must be > 0; please use TotalHitCountCollector if you just need the total hit count
The query is the following, with varying 'from', but never larger than 750:
{
"track_total_hits": true,
"size": 15,
"from": 750,
"sort": [
{
"_score": {
"order": "desc"
}
},
{
"sortDate": {
"order": "desc"
}
}
],
"query": {
"function_score": {
"boost_mode": "sum",
"query": {
"bool": {
"filter": [
{
"match_all": {}
}
],
"must": []
}
},
"functions": [
{
"weight": 5.0
},
{
"weight": 1.0
},
{
"filter": {
"nested": {
"path": "addOns",
"query": {
"bool": {
"filter": [
{
"terms": {
"addOns.addOnID": [
8,
10
]
}
},
{
"range": {
"addOns.startDate": {
"lte": "2020-04-04T15:56:16.8498491+02:00"
}
}
},
{
"range": {
"addOns.finishDate": {
"gte": "2020-04-04T15:56:16.8498491+02:00"
}
}
}
]
}
}
}
},
"weight": 10.0
}
]
}
}
}
I have increased the index to "max_result_window": "50000".
It is a standalone installation v. 7.5.2
The index has 1 shard and 0 replica.
The index never have more than 30.000 documents.
Why do the server throw Bad Request: "numHits must be > 0; please use TotalHitCountCollector if you just need the total hit count" ?