ES命令: “track_total_hits“:true

搜索type全部数据

GET test/movie/_search

结果

{
  "took": 2,    //耗费时间 毫秒
  "timed_out": false, //是否超时
  "_shards": {
    "total": 5,   //发送给全部5个分片
    "successful": 5,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": 3,  //命中3条数据
    "max_score": 1,   //最大评分
    "hits": [  // 结果
      {
        "_index": "test",
        "_type": "movie",
        "_id": 2,
        "_score": 1,
        "_source": {
          "id": "2",
          "name": "operation meigong river",
          "doubanScore": 8.0,
          "actorList": [
            {
              "id": "1",
              "name": "zhang han yu"
            }
          ]
        }
      }

 

  "track_total_hits":true 的作用

#获取超过1w条数据 需要加上  "track_total_hits":true ,不然只能显示出9999条
GET /pg03_h3/_doc/_search
{
  "_source":["terminalId",
              "lon",
              "lat",
              "time",
              "h3_2"
            ],
  "query": {"match": {
    "h3_2":"586321722337132543"
  }},
  "size":10000,
  "track_total_hits":true
}

 

ES命令: “track_total_hits“:true_第1张图片

ES命令: “track_total_hits“:true_第2张图片 

你可能感兴趣的:(es)