Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Elasticsearch returns different results from same paginated query

So I have been playing with paginating and am trying to resolve an issue where a result on page 64 will sometimes contain a hit on page 65.

If I execute this query

http://host:9200/index/_search?q=field:searchterm&size=1&from=100

I discover that every second query result is identical.

But if the pagination parameter has a lower value, all results are identical.

I've played with sorting, but the behavior is consistent.

like image 737
Gervase Avatar asked Dec 08 '25 19:12

Gervase


1 Answers

Try adding a preference param to the request parameter. I'm guessing this could be due to the bouncing result issue.

For load balancing you could probably use preference parameter with a custom string such as username for the initial request.

Use the same custom string for subsequent pagination requests

like image 125
keety Avatar answered Dec 11 '25 04:12

keety



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!