Multiple terms query match with pagination

I am using elastic search in my node js projec, version of elastic search is 6.2 .I have used NPM package mongosastic for searching the index.During a multiple terms query search the pagination is not working.The same result is returned after each hit of pagination.The query is supposed to sort by date of the field being created.
Query
Paperupload.esSearch({
from:from,
size:size,
query:{
bool:{
"must": {
"bool" : { "should": [{terms : {"userId._id": followersDetail}}] }
},
"must": {
"bool" : { "should": [{terms : {"topics.topic_name": topi}}] }
},
"must_not": {
"bool" : { "should": [{terms : {"_id": userPapersId}}] }
}
}
},
sort:{
"createdAt":{
"order" : "desc"
}
}
},
function(err, results) {
con
})

Are you sure the from and size parameters are being set correctly?
Also, recognise that the search API does not preserve a single-point-in-time view between requests so any updates between requests may push something that was on page1 of search request 1 onto page 2 of search request 2, particularly if sorting by date.

my first hit FROM is 0 and size is 20.In Next hit from is 1 and size is 20

from is the document number not a page number.

This is asking for everything after the first doc

So my next hit should be from is 20 and size is 20

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