es 按条件查询数据总条数
es 按条件查询数据总条数
·
语句示例
//请求地址
post
http://eshost:9200/esindex-20220502/_search?
//查询条件:
{
"query": {
"bool": {
"must": [{
"term": {
"trace_type.keyword": "xxxxxx"
}
}, {
"term": {
"product_type.keyword": "aaaaa"
}
}],
"must_not": [],
"should": []
}
},
"from": 0,
"size": 0,
"sort": [],
"track_total_hits":true,//开启精确查询,没有此字段,total最大10000条
"aggs": {}
}
//响应结果:
{
"took": 7,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 51297,
"relation": "eq"
},
"max_score": null,
"hits": []
}
}
更多推荐
已为社区贡献16条内容
所有评论(0)