track_total_hits :
7.0 参考:https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-request-track-total-hits.html
Query DSL
{
"track_total_hits": true,
"query": {
"range": {
"ts": {
"gte": 0
}
}
}
}
.net core Nest:
var search = _client.Search<SearchModel>(s => s
.From(pageFrom)
.Size(PageSize)
.TrackTotalHits(true)
.Query(q => MyQuery())
.Sort(t => MySort())
);
return search;
search.Total 就是真实的结果数