Customise score based on Search Results Pagination

Hi Team,

I have some documents in ES and I want results in pagination and for that I'm using From/Offset. But lets suppose I want 5 documents in every page and in each page I want some documents should be at the bottom of respective page irrespective of document score.

Can someone guide me an approach to solve this problem.

1st Page Response: In this I want document 4 and 5 should be at the bottom and lets assume I change the document scores to 0

      "docs": [
        {
          "_id": 1,
          "name": "jack",
          "score": 40
        },
        {
          "_id": 2,
          "name": "ryan",
          "score": 30
        },
        {
          "_id": 3,
          "name": "mark",
          "score": 20
        },
        {
          "_id": 4,
          "name": "taylor",
          "score": 0
        },
        {
          "_id": 5,
          "name": "taylor",
          "score": 0
        }
      ]
    }

2nd Page Response: In this I want document 9 and 10 should be at the bottom

      "docs": [
        {
          "_id": 6,
          "name": "jack",
          "score": 22
        },
        {
          "_id": 7,
          "name": "ryan",
          "score": 20
        },
        {
          "_id": 8,
          "name": "mark",
          "score": 15
        },
        {
          "_id": 9,
          "name": "taylor",
          "score": 0
        },
        {
          "_id": 10,
          "name": "taylor",
          "score": 0
        }
      ]
    }

Can some one please help me to solve this issue

Thanks & Regards

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.