1.header查詢
添加rest_total_hits_as_int=true即可
?
2.使用es-sql的方式查詢
需要在sql里面添加?/*! TRACK_TOTAL_HITS(true) */或者用/*! TRACK_TOTAL_HITS(10001) */直接限制記錄數(shù)量查詢即可
文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-437052.html
?請(qǐng)求地址
http://172.21.72.165:9200/_nlpcn/sql
請(qǐng)求頭
Content-Type:application/json
Authorization:Basic ZWxhc3RpYzoxMjM0NTY=
請(qǐng)求入?yún)?br> {
?? ?"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"
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? ]
? ? }
}文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-437052.html
到了這里,關(guān)于Elasticsearch 7 以上版本顯示hits.total超過(guò)10000條設(shè)置的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!