elasticsearch分页查询时最高只能查前10000条

  • Post author:
  • Post category:其他


解决办法:

1、在查询语句中增加一个字段:“track_total_hits”: true (能解决)

//查结果列表同时获取总数,用_search,加上track_total_hits=true
//仅获取总数,使用_count (无需加track_total_hits=true)
POST /test_index/_search   //(_count)
{
   
  //在“query”前加上,可以分页查询10000之后的数据
  "track_total_hits":true,
  "query": {
   
    "match_all"



版权声明:本文为weixin_45826787原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。