Handle total hits equal to track_total_hits (#37907)
This change ensures that a total hits equal to the value set for track_total_hits is not considered as a lower bound.
This commit is contained in:
parent
e94d32d069
commit
160dc29f0e
|
@ -56,7 +56,7 @@ setup:
|
||||||
---
|
---
|
||||||
"hits.total as an object":
|
"hits.total as an object":
|
||||||
- skip:
|
- skip:
|
||||||
version: " - 6.99.99"
|
version: " - 7.0.99"
|
||||||
reason: hits.total is rendered as an object in 7.0.0
|
reason: hits.total is rendered as an object in 7.0.0
|
||||||
|
|
||||||
- do:
|
- do:
|
||||||
|
@ -106,7 +106,7 @@ setup:
|
||||||
|
|
||||||
- do:
|
- do:
|
||||||
search:
|
search:
|
||||||
size: 3
|
size: 0
|
||||||
track_total_hits: 4
|
track_total_hits: 4
|
||||||
body:
|
body:
|
||||||
query:
|
query:
|
||||||
|
@ -116,6 +116,18 @@ setup:
|
||||||
- match: {hits.total.value: 4}
|
- match: {hits.total.value: 4}
|
||||||
- match: {hits.total.relation: gte}
|
- match: {hits.total.relation: gte}
|
||||||
|
|
||||||
|
- do:
|
||||||
|
search:
|
||||||
|
size: 0
|
||||||
|
track_total_hits: 5
|
||||||
|
body:
|
||||||
|
query:
|
||||||
|
match:
|
||||||
|
foo: bar
|
||||||
|
|
||||||
|
- match: {hits.total.value: 5}
|
||||||
|
- match: {hits.total.relation: eq}
|
||||||
|
|
||||||
- do:
|
- do:
|
||||||
catch: /\[rest_total_hits_as_int\] cannot be used if the tracking of total hits is not accurate, got 100/
|
catch: /\[rest_total_hits_as_int\] cannot be used if the tracking of total hits is not accurate, got 100/
|
||||||
search:
|
search:
|
||||||
|
|
|
@ -754,7 +754,7 @@ public final class SearchPhaseController {
|
||||||
assert totalHitsRelation == Relation.EQUAL_TO;
|
assert totalHitsRelation == Relation.EQUAL_TO;
|
||||||
return new TotalHits(totalHits, totalHitsRelation);
|
return new TotalHits(totalHits, totalHitsRelation);
|
||||||
} else {
|
} else {
|
||||||
if (totalHits < trackTotalHitsUpTo) {
|
if (totalHits <= trackTotalHitsUpTo) {
|
||||||
return new TotalHits(totalHits, totalHitsRelation);
|
return new TotalHits(totalHits, totalHitsRelation);
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue