fix: enable trackTotalHits for accurate OpenSearch result counts
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -125,6 +125,7 @@ public class OpenSearchIndex implements SearchIndex {
|
|||||||
return org.opensearch.client.opensearch.core.SearchRequest.of(b -> {
|
return org.opensearch.client.opensearch.core.SearchRequest.of(b -> {
|
||||||
b.index(INDEX_PREFIX + "*")
|
b.index(INDEX_PREFIX + "*")
|
||||||
.query(buildQuery(request))
|
.query(buildQuery(request))
|
||||||
|
.trackTotalHits(th -> th.enabled(true))
|
||||||
.size(size)
|
.size(size)
|
||||||
.from(request.offset())
|
.from(request.offset())
|
||||||
.sort(s -> s.field(f -> f
|
.sort(s -> s.field(f -> f
|
||||||
|
|||||||
Reference in New Issue
Block a user