Search code examples
phpelasticsearchluceneelastica

Applying Cursors pagination in elasticaserch


Im new to elasticasearch and trying to apply the cursor paginatoin seen in facebook, twitter for my api.

Is there a way to apply that throw filters, aggregations i already tried a couple queries but the issue that i can reserve the order of the documents, any help will be appreciated ?


Solution

  • You can paginate through the from and size parameters:

    {
        "from" : 0, "size" : 10,
        "query" : {
            "term" : { "user" : "kimchy" }
        }
    }