ElasticNest7.xQuery获取Total
track_total_hits :
7.0 参考:https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-request-track-total-hits.html
7.8 参考: https://www.elastic.co/guide/en/elasticsearch/reference/7.8/search-request-body.html#request-body-search-track-total-hits
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 就是真实的结果数
以上是 ElasticNest7.xQuery获取Total 的全部内容, 来源链接: utcz.com/z/517729.html