Elasticsearch學習之 Search After 結果分頁顯示
阿新 • • 發佈:2018-11-11
Search After
- 通過提供一個live cursor來規避消耗儲存和時間的效能問題
- 通過上一頁的結果幫助檢索下一頁
- 如下面這個示例,按照第一個檢索到的最後顯示的“balance”和‘_id’值,作為下一個檢索search_after的引數
當使用search_after引數時,from的值必須被設為0或者-1
curl -XGET "http://localhost:9200/bank/_search" -H 'Content-Type: application/json' -d' { "size": 10, "query": { "match" : { "address" : "place" } }, "sort": [ {"balance": "asc"}, {"_id": "desc"} ] }' curl -XGET "http://localhost:9200/bank/_search" -H 'Content-Type: application/json' -d' { "size": 10, "query": { "match" : { "address" : "place" } }, "search_after": [4652, "590"], "sort": [ {"balance": "asc"}, {"_id": "desc"} ] }'