1.header查询
添加rest_total_hits_as_int=true即可
2.使用es-sql的方式查询
需要在sql里面添加 /*! TRACK_TOTAL_HITS(true) */或者用/*! TRACK_TOTAL_HITS(10001) */直接限制记录数量查询即可
文章来源:https://www.toymoban.com/news/detail-437052.html
请求地址
http://172.21.72.165:9200/_nlpcn/sql
请求头
Content-Type:application/json
Authorization:Basic ZWxhc3RpYzoxMjM0NTY=
请求入参
{
"sql": "select /*! TRACK_TOTAL_HITS(true) */is_active,cur_mon_package_order_cnt from mcc_sub_extend_001_es_20211211 limit 1"
}
返回值:
{
"took": 2,
"timed_out": false,
"_shards": {
"total": 8,
"successful": 8,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 10004,
"relation": "eq"
},
"max_score": 1,
"hits": [
{
"_index": "mcc_sub_extend_001_es_20211211",
"_type": "_doc",
"_id": "1dxJqH0B3nAO-b3QdSba",
"_score": 1,
"_source": {
"is_active": "0",
"cur_mon_package_order_cnt": "2"
}
}
]
}
}文章来源地址https://www.toymoban.com/news/detail-437052.html
到了这里,关于Elasticsearch 7 以上版本显示hits.total超过10000条设置的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!