1.请求方式:GET

2.请求URL: 

http://127.0.0.1:9200/shopping/_search

3.请求参数:

from: 从第几条开始

size:每页条数

_source: 查询字段

sort: 排序字段,

order :排序方式

{
    "query" : {
        "match_all" : {}
    },
    "from" : 0,
    "size" : 2,
    "_source" : ["title", "price"],
    "sort" : {
        "price" : {
            "order" : "desc"
        }
    }

}

4. 响应信息:

{
    "took": 6,
    "timed_out": false,
    "_shards": {
        "total": 1,
        "successful": 1,
        "skipped": 0,
        "failed": 0
    },
    "hits": {
        "total": {
            "value": 9,
            "relation": "eq"
        },
        "max_score": null,
        "hits": [
            {
                "_index": "shopping",
                "_type": "_doc",
                "_id": "1009",
                "_score": null,
                "_source": {
                    "price": 9999.0,
                    "title": "小米手机"
                },
                "sort": [
                    9999.0
                ]
            },
            {
                "_index": "shopping",
                "_type": "_doc",
                "_id": "1008",
                "_score": null,
                "_source": {
                    "price": 8999.0,
                    "title": "小米手机"
                },
                "sort": [
                    8999.0
                ]
            }
        ]
    }
}

【Elasticsearch Postman版】分页查询、排序、查询字段_代码