Elasticsearch 6.x 的分页查询数据

 {
     "size" :3,
     "query": {
        "match" : {
            "person_name" : "张老师"
        }},
        "search_after": [1244735520000, 805649],
        "sort": [
        {"create_time": "asc"},
        {"pk": "desc"}
    ]
  }

URL http://10.10.6.225:9200/t_resource_info/_search

方式:POST

返回的查询结果:

{
  "took": 99,
  "timed_out": false,
  "_shards": {
    "total": 5,
    "successful": 5,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": 1452923,
    "max_score": null,
    "hits": [
      {
        "_index": "t_resource_info",
        "_type": "doc",
        "_id": "199_805683",
        "_score": null,
        "_source": {
          "resource_format": "mp3",
          "pk": 805683,
          "structure_id": 77638,
          "person_id": 34,
          "id": "199_805683",
          "create_time": "2009-06-11 15:59:38",
          "table_name": "t_resource_info",
          "resource_type_name": "音频",
          "file_id": "C28DFAEF-904E-46C3-8119-4A78B0E337CE",
          "resource_type": 3,
          "resource_id_int": 772237,
          "@version": "1",
          "identity_id": 5,
          "area_code": 199,
          "resource_page": 0,
          "down_count": 0,
          "@timestamp": "2018-03-03T08:56:42.516Z",
          "resource_id_char": "417d63b5-4549-4012-83ba-3d33739dedf6",
          "resource_title": "最后一课",
          "type": "dsideal_db",
          "person_name": "张老师"
        },
        "sort": [
          1244735978000,
          805683
        ]
      },
      {
        "_index": "t_resource_info",
        "_type": "doc",
        "_id": "199_805700",
        "_score": null,
        "_source": {
          "resource_format": "mp3",
          "pk": 805700,
          "structure_id": 77643,
          "person_id": 34,
          "id": "199_805700",
          "create_time": "2009-06-11 16:02:22",
          "table_name": "t_resource_info",
          "resource_type_name": "音频",
          "file_id": "8CD3DA0A-63F2-4CBF-BCA6-0D14345813D5",
          "resource_type": 3,
          "resource_id_int": 772254,
          "@version": "1",
          "identity_id": 5,
          "area_code": 199,
          "resource_page": 0,
          "down_count": 0,
          "@timestamp": "2018-03-03T08:56:42.517Z",
          "resource_id_char": "c60247c3-5ab3-41b1-b772-40d24ed187a3",
          "resource_title": "最后一课",
          "type": "dsideal_db",
          "person_name": "张老师"
        },
        "sort": [
          1244736142000,
          805700
        ]
      },
      {
        "_index": "t_resource_info",
        "_type": "doc",
        "_id": "199_805719",
        "_score": null,
        "_source": {
          "resource_format": "mp3",
          "pk": 805719,
          "structure_id": 77648,
          "person_id": 34,
          "id": "199_805719",
          "create_time": "2009-06-11 16:09:18",
          "table_name": "t_resource_info",
          "resource_type_name": "音频",
          "file_id": "1F6F1D59-FF2D-43CF-B4ED-A08CB62F2943",
          "resource_type": 3,
          "resource_id_int": 772273,
          "@version": "1",
          "identity_id": 5,
          "area_code": 199,
          "resource_page": 0,
          "down_count": 0,
          "@timestamp": "2018-03-03T08:56:42.567Z",
          "resource_id_char": "c1c6fc35-aa64-4c83-9322-ef62ec82ff2d",
          "resource_title": "最后  一课",
          "type": "dsideal_db",
          "person_name": "张老师"
        },
        "sort": [
          1244736558000,
          805719
        ]
      }
    ]
  }
}

 

你可能感兴趣的:(Elasticsearch 6.x 的分页查询数据)